How to Use wget With Username and Password for FTP/HTTP Site on Linux

Wget is a powerful command-line utility for downloading files from the internet. It supports various protocols, including HTTP, HTTPS, and FTP. In some cases, you may need to download files from a password-protected site, which requires authentication using a username and password.

This short guide will walk you through the process of using wget with a username and password to download files on Linux.

Step 1: Install wget

First, ensure that wget is installed on your Linux system. If it is not already installed, you can install it using your system’s package manager.

See also  How to Install Webtatic Repository on RHEL 6/CentOS 6

For Debian and Ubuntu-based systems, use the following command:

sudo apt-get install wget

For CentOS, RHEL, and Fedora-based systems, use this command:

sudo yum install wget

Step 2: Download a File with Username and Password

After wget is installed, you can use it to download files from a protected site by including your username and password. Here’s how to do it for HTTPS and FTP sites:

For HTTPS:

wget --user=<username> --password=<password> https://webhostinggeeks.com/yourfile.txt

Replace <username> and <password> with your actual username and password for the protected site.

See also  How to Install Apache httpd on Linux Fedora 16 Server

For FTP:

wget --user=<username> --password=<password> ftp://webhostinggeeks.com/yourfile.txt

Again, replace <username> and <password> with your actual username and password for the protected site.

Commands and Their Functions:

  • wget – The command-line utility for downloading files from the internet
  • –user – Specifies the username to use for authentication
  • –password – Specifies the password to use for authentication

The Outcome

By following this guide, you have successfully used wget with a username and password to download files from protected HTTP and FTP sites on Linux. This method allows you to access and download files from sites that require authentication securely.

See also  How to Disable SELinux on RHEL 7/CentOS 7/Oracle Linux 7

We hope this guide has been helpful in explaining how to use wget with a username and password for FTP/HTTP sites on Linux. If you have any suggestions or improvements, please feel free to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *