Linux wget and http authentication

Table of Contents

Learn All About Linux wget and HTTP authentication

We covered how to enable HTTP authentication in Nginx web server in a previous article As a result, we also need to cover how to fetch web objects with wget when the objects require http basic authentication.

HTTP Basic authentication allows to protect web locations or subdomains with a basic user/password authentication schema.

Wget is the tool to download http/https pages or objects from your Linux VPS CLI and, fortunately, it can fetch these resources even if they protected with http basic auth. For resources protected with session/cookie systems, it is more complex.

Wget files from HTTP authentication websites

$ wget --http-user=[HTTP-USER] --http-passwd=[HTTP-PASSWORD]

Since the username and password used by wget to perform the HTTP authentication are used in a CLI, they will remain in your shell’s history. Make sure you clear these lines by logging out and logging back in and editing the history file. For bash, it is .bash_history in your root directory.


You can actually create these settings on our platform in few minutes utilizing our PCS (Private Cloud Solution) which allows you to have VPSie(s) on a private network – NAT – Port forward – traffic control for inbound and outbound – multiple gateway IPs which you could use for the load-balancing and failover.


Share on