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’ \ http://linkofwebsite.com/login.php
Then grab the file or page that you want:
# wget –load-cookies cookies_down.txt \ -p http://linkofwebsite.com/fileorpage.php
Other method is to user another parameters:
and use like this:
# wget http://www.linkofwebsite.com –user=youruser –password=yourpass
and if you have some problems you can use –auth-no-challenge :
# wget http://www.linkofwebsite.com –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.