How To Use wget With Username and Password for FTP / HTTP File Retrieval

by Vivek Gite on May 2, 2008 · 12 comments

Q. How do I use wget ftp / http client tool to download files from password protected web page?

A. wget command supports username and password combo for both FTP and HTTP file retrieval.

Pass following option to wget command:
--user=userName: Your FTP/HTTP username
--password=passWord : Your HTTP/FTP password

These parameters can be overridden using the --ftp-user and --ftp-password options for FTP connections and the --http-user and --http-password options for HTTP connections.

Download a file called foo.pdf from theos.in:
$ wget --user=vivek --password='myPassword' http://theos.in/protected/area/foo.pdf

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

{ 12 comments… read them below or add one }

1 lakshminarayanan May 14, 2008

wow…that was cool!

Reply

2 chadido August 8, 2009

thats great u saved me

Reply

3 Mauricio Hernandez August 21, 2009

Could this be used for rapidshare?

Reply

4 Vagin August 24, 2009

Didn’t work for me. I am on a windows machine. Not sure if that makes a diffrence.

Reply

5 iqueen November 18, 2009

gnuwin32.sf.net
wget 1.12
–ftp-user=
–ftp-password=

Reply

6 Asterisk January 12, 2010

Works Like a charm!!!
tx.

Reply

7 meitham July 10, 2010

I need to download a file from my server on another machine with wget, using -p password as an argument is not an option since people could simply find my password with a ps command! Do you know anyway I could force wget to ask for my password after typing the command? like when do mysql -u root -p and it will ask you for the root password?
thanks

Reply

8 Rahman August 25, 2010

Works Like a charm!!!
tx. [2]

Reply

9 Tony Palmer November 2, 2010

wget does not work directly if the site redirects to form based login page, i.e. no HTTP 401 returned

Reply

10 Mohamed Jameer March 24, 2011

Its Working fine, Thx a lots..

Reply

11 Chris Shennan August 4, 2011

As easy at that! This made downloading a large XML file much easier than using a browser which ended up crashing 9 out of 10 times.

Many thanks.

Chris.

Reply

12 Reddy Siva Saran K January 18, 2012

I tried the following command which gave a Error Response
The Response is
Resolving cambuild.qalab.cam.novell.com… 164.99.129.35
Connecting to cambuild.qalab.cam.novell.com|164.99.129.35|:80… connected.
HTTP request sent, awaiting response… 403 Forbidden
2012-01-18 10:07:51 ERROR 403: Forbidden.

Have any one faced a similar issue and if yes can you let me know how to come out from this

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 5 + 12 ?
Please leave these two fields as-is:
Solve the simple math so we know that you are a human and not a bot.




Previous post:

Next post: