How to do a wget with authentication

Somedays we have the necessity of download a webpage or a file that requires a username and a password.

Of course you can go to the webpage, post the login and password and download the file or webpage. But, when we talk about a Terminal it’s not the same. 

The solution to use the Terminal on Linux and download a file is this:

First, login only once to the server/webpage with the right credentials:

# wget –save-cookies cookies_down.txt \ –post-data ‘user=youuser&password=yourpass’ \

Then grab the file or page that you want:

# wget –load-cookies cookies_down.txt \ -p

Other method is to user another parameters:

–user=USERNAME –password=PASS

and use like this:

# wget –user=youruser –password=yourpass

and if you have some problems you can use –auth-no-challenge :

# wget –user=youruser –password=yourpass   –auth-no-challenge

and that’s it. 🙂

Don’t forget to subscribe my newsletter to receive tips and other interesting info.


No Comments

Post a Comment