Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the correct wget command syntax for HTTPS with username and password?

Tags:

wget

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.

like image 889
Emerson Maningo Avatar asked Jan 30 '13 02:01

Emerson Maningo


People also ask

How do I enter my wget USERNAME and password?

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.

Can you use wget for https?

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.

How do I download https using wget?

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.

What command is wget?

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.


1 Answers

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 
like image 173
thomasbabuj Avatar answered Sep 19 '22 02:09

thomasbabuj