LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 02-14-2013, 05:07 PM   #1
brandoness
LQ Newbie
 
Registered: Feb 2013
Posts: 14

Rep: Reputation: Disabled
wget authntication issues on RHEL5 v. RHEL6


Hello,

I maintain both RHEL5 and RHEL 6 servers. In order to connect to the outside web I must first authenticated to a web proxy and if no GUI browser is available (Firefox) I used lynx.

I'm writing a BASH script that downloads a lot of .tar source files from public sites, ie gnu.org. The intended users of the script would just like to execute the script, enter their credentials and have it complete it's task.

The command below works on RHEL6, but not RHEL5. I cannot get it to work on RHEL5, due to the older version of wget. Any ideas?

Thanks in advance

Code:
wget --user=USERNAME --ask-password http://URL
 
Old 02-14-2013, 06:05 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Could be something like
Code:
wget --ask-password >/dev/null 2>&1; 
case $? in 
 0) wget --user=USERNAME --ask-password http://URL
    ;;
 2) echo "Enter password:"; 
    read WGETPASS; 
    wget --proxy-user=$LOGNAME --proxy-password=$WGETPASS proto://c.ol/
    ;;
esac
No idea if it works, YMMV(VM).
 
Old 02-14-2013, 06:12 PM   #3
brandoness
LQ Newbie
 
Registered: Feb 2013
Posts: 14

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by unSpawn View Post
Could be something like
Code:
wget --ask-password >/dev/null 2>&1; 
case $? in 
 0) wget --user=USERNAME --ask-password http://URL
    ;;
 2) echo "Enter password:"; 
    read WGETPASS; 
    wget --proxy-user=$LOGNAME --proxy-password=$WGETPASS proto://c.ol/
    ;;
esac
No idea if it works, YMMV(VM).
Thanks for the reply. I already have that but not in a case loop, but just with

Code:
read -p "What is your User ID?" USER_ID;
read -p "What is your Password" PASSWORD;
Easily to reuse the environment variables in the entire script.

I found the proxy-user and proxy-password options it's just I have ! and @ in my password and they require the correct escape sequences to work.
 
1 members found this post helpful.
Old 02-17-2013, 09:27 PM   #4
brandoness
LQ Newbie
 
Registered: Feb 2013
Posts: 14

Original Poster
Rep: Reputation: Disabled
Figured I should post that I resolved the error. Using
Code:
wget -nc --proxy-user=$USER_ID --proxy-password='$PASSWORD'
worked I just had to encapsulate the password with soft (single) quotes or doing set +H at the beginning of the script works too.

Last edited by brandoness; 02-17-2013 at 09:28 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
RHEL5 vs RHEL6 kickstart theillien Linux - Server 0 11-18-2012 03:43 PM
yum update rhel5.1 to rhel6 jindalarpan Linux - Server 4 08-06-2012 02:47 AM
difference between RHEL5 and RHEL6 jana Linux - Server 1 03-20-2012 02:41 PM
can we use old rhel5 when we having rhel6 subscription anujkaushal Red Hat 3 09-09-2011 12:58 AM
[SOLVED] difference between rhel5 and rhel6 manoj jasawat Linux - Newbie 4 04-11-2011 04:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 01:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration