I would like to download a file remotely with this URL using wget:
https://test.mydomain.com/files/myfile.zip
The site test.mydomain.com requires a login. I would like to download that file in my another server using this command but it does not work (does not completely download the file):
wget --user=myusername --password=mypassword https://test.mydomain.com/files/myfile.zip
If my username is myusername and password is mypassword what would be the correct wget syntax?
The following are the return messages after I type the above command:
Resolving test.mydomain.com (test.mydomain.com)... 123.456.789 Connecting to test.mydomain.com (test.mydomain.com)|123.456.789|:443... connected. HTTP request sent, awaiting response... 302 Found Location: https://test.mydomain.com/login/unauthorized [following] --2013-01-30 02:01:32-- https://test.mydomain.com/login/unauthorized Reusing existing connection to test.mydomain.com:443. HTTP request sent, awaiting response... 302 Found Location: https://test.mydomain.com/login [following] --2013-01-30 02:01:32-- https://test.mydomain.com/login Reusing existing connection to test.mydomain.com:443. HTTP request sent, awaiting response... 200 OK Length: unspecified [text/html] Saving to: `myfile.zip'
Am I missing something? Please help. Thanks.
You can provide authentication credential via --user=USERNAME and --password=PASSWORD ; based on the man wget , the command can be overridden using the --http-user=USERNAME and --http-password=PASSWORD for http connection and the --ftp-use=USERNAME and --ftp-password=PASSWORD for ftp connection.
GNU Wget is a free utility for the non-interactive download of files from the Web. It supports various protocols such as HTTP, HTTPS, and FTP protocols and retrieval through HTTP proxies. Wget is non-interactive, meaning that it can work in the background while the user is not logged on to the system.
In order to download a file using Wget, type wget followed by the URL of the file that you wish to download. Wget will download the file in the given URL and save it in the current directory. Let's download a minified version of jQuery using the following command: wget https://code.jquery.com/jquery-3.6.0.min.js.
The wget command is a command line utility for downloading files from the Internet. It supports downloading multiple files, downloading in the background, resuming downloads, limiting the bandwidth used for downloads and viewing headers.
By specifying the option --user and --ask-password wget will ask for the credentials. Below is an example. Change the username and download link to your needs.
wget --user=username --ask-password https://xyz.com/changelog-6.40.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With