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

Twitter and LinuxGNU Wget is a free software package for retrieving files using HTTP, HTTPS and FTP, the most widely-used Internet protocols. Some of the website and most of ftp site on internet require username and password in order to access the pages. This post will describe how to use wget with basic authentication.The following example of wget commands should allow you to access pages on a website that requires a username and password:

wget http://username:myPassword@www.ehowstuff.local/example/file.txt
wget --http-user=username --http-password=myPassword http://www.ehowstuff.local/example/file.txt
wget --user=username --password='myPassword' ftp://www.ehowstuff.local/example/file.txt
wget -r --user=username --password='myPassword' ftp://www.ehowstuff.local/example/

How to Install wget, telnet, man Utility on CentOS 6.4

centos 6.3On minimal CentOS 6.4 installation, wget, man and telnet command utilities does not install automatically. Wget is a free network utility for linux to download files from the Web. Man is used to display the manual page for other command and also will help you to explain the functions for the commands that commonly used. The term “man” is short for manual. Telnet is a network protocol used on the Internet or local area networks. Telnet is a user command and an underlying TCP/IP protocol for accessing remote computers and very useful for troubleshooting and verify the opened ports. You will get the following warning when you use wget, man and telnet on minimal CentOS 6.4 installation.

[root@centos64 ~]# wget
-bash: wget: command not found
[root@centos64 ~]# man
-bash: man: command not found
[root@centos64 ~]# telnet
-bash: telnet: command not found

So here are the steps to install those three useful command utilities :

[root@centos64 ~]# yum install wget man telnet -y

Full installation :

[root@centos64 ~]# yum install wget man telnet -y
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: mirrors.hostemo.com
 * extras: mirrors.hostemo.com
 * updates: mirrors.hostemo.com
base                                                                         | 3.7 kB     00:00
extras                                                                       | 3.5 kB     00:00
updates                                                                      | 3.5 kB     00:04
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package man.x86_64 0:1.6f-32.el6 will be installed
--> Processing Dependency: lzma for package: man-1.6f-32.el6.x86_64
---> Package telnet.x86_64 1:0.17-47.el6_3.1 will be installed
---> Package wget.x86_64 0:1.12-1.8.el6 will be installed
--> Running transaction check
---> Package xz-lzma-compat.x86_64 0:4.999.9-0.3.beta.20091007git.el6 will be installed
--> Processing Dependency: xz = 4.999.9-0.3.beta.20091007git.el6 for package: xz-lzma-compat-4.999.9-0.3.beta.20091007git.el6.x86_64
--> Running transaction check
---> Package xz.x86_64 0:4.999.9-0.3.beta.20091007git.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package                Arch           Version                                   Repository    Size
====================================================================================================
Installing:
 man                    x86_64         1.6f-32.el6                               base         263 k
 telnet                 x86_64         1:0.17-47.el6_3.1                         base          58 k
 wget                   x86_64         1.12-1.8.el6                              base         482 k
Installing for dependencies:
 xz                     x86_64         4.999.9-0.3.beta.20091007git.el6          base         137 k
 xz-lzma-compat         x86_64         4.999.9-0.3.beta.20091007git.el6          base          16 k

Transaction Summary
====================================================================================================
Install       5 Package(s)

Total download size: 955 k
Installed size: 2.8 M
Downloading Packages:
(1/5): man-1.6f-32.el6.x86_64.rpm                                            | 263 kB     00:05
(2/5): telnet-0.17-47.el6_3.1.x86_64.rpm                                     |  58 kB     00:00
(3/5): wget-1.12-1.8.el6.x86_64.rpm                                          | 482 kB     00:09
(4/5): xz-4.999.9-0.3.beta.20091007git.el6.x86_64.rpm                        | 137 kB     00:04
(5/5): xz-lzma-compat-4.999.9-0.3.beta.20091007git.el6.x86_64.rpm            |  16 kB     00:00
----------------------------------------------------------------------------------------------------
Total                                                                42 kB/s | 955 kB     00:22
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : xz-4.999.9-0.3.beta.20091007git.el6.x86_64                                       1/5
  Installing : xz-lzma-compat-4.999.9-0.3.beta.20091007git.el6.x86_64                           2/5
  Installing : man-1.6f-32.el6.x86_64                                                           3/5
  Installing : 1:telnet-0.17-47.el6_3.1.x86_64                                                  4/5
  Installing : wget-1.12-1.8.el6.x86_64                                                         5/5
  Verifying  : xz-lzma-compat-4.999.9-0.3.beta.20091007git.el6.x86_64                           1/5
  Verifying  : man-1.6f-32.el6.x86_64                                                           2/5
  Verifying  : xz-4.999.9-0.3.beta.20091007git.el6.x86_64                                       3/5
  Verifying  : wget-1.12-1.8.el6.x86_64                                                         4/5
  Verifying  : 1:telnet-0.17-47.el6_3.1.x86_64                                                  5/5

Installed:
  man.x86_64 0:1.6f-32.el6      telnet.x86_64 1:0.17-47.el6_3.1      wget.x86_64 0:1.12-1.8.el6

Dependency Installed:
  xz.x86_64 0:4.999.9-0.3.beta.20091007git.el6
  xz-lzma-compat.x86_64 0:4.999.9-0.3.beta.20091007git.el6

Complete!

How to Install wget on RHEL 6

Symptoms :
When i try to download the software package using wget command, i get the following error :

    -bash: wget: command not found
    

Solutions :
wget command does not exist on your Redhat Enterprise Linux 6 (RHEL 6) Linux server. Wget is a free network utility for linux to download files from the Web. Therefore, there is simple step to install the wget command utility into your RHEL 6 server. Assumed that you have set up local yum repository using your DVDrom. If you haven’t set up the local yum repository, please proceed to this steps ;

How to Setup Local Yum Repository from CD-ROM/DVD-ROM image on RHEL 6

    [root@rhel6 ~]# yum install wget -y
    Loaded plugins: rhnplugin
    This system is not registered with RHN.
    RHN support will be disabled.
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package wget.i686 0:1.12-1.4.el6 set to be updated
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ====================================================================================================
     Package          Arch             Version                   Repository                        Size
    ====================================================================================================
    Installing:
     wget             i686             1.12-1.4.el6              DVD-RHEL6-Repository             481 k
    
    Transaction Summary
    ====================================================================================================
    Install       1 Package(s)
    Upgrade       0 Package(s)
    
    Total download size: 481 k
    Installed size: 1.8 M
    Downloading Packages:
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing     : wget-1.12-1.4.el6.i686                                                       1/1
    
    Installed:
      wget.i686 0:1.12-1.4.el6
    
    Complete!
    

How to Install wget on CentOS 5.7

If your CentOS 5.7 server has been installed with minimal installation, wget command will not exist. Wget is a free network utility for linux to download files from the Web. Therefore, there is simple step to install the wget command utility into your CentOS 5.7 server.

When i try to download the webmin, i got this error:

[root@CentOS57 ~]# wget http://prdownloads.sourceforge.net/webadmin/webmin-1.570.tar.gz
-bash: wget: command not found

Simply run this command to install wget

[root@CentOS57 ~]# yum install wget
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.vr-zone.com
 * extras: centos.vr-zone.com
 * updates: centos.vr-zone.com
base                                                                         | 1.1 kB     00:00
extras                                                                       | 2.1 kB     00:00
updates                                                                      | 1.9 kB     00:00
updates/primary_db                                                           | 480 kB     00:03
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package wget.i386 0:1.11.4-2.el5_4.1 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package             Arch                Version                          Repository           Size
====================================================================================================
Installing:
 wget                i386                1.11.4-2.el5_4.1                 base                582 k

Transaction Summary
====================================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 582 k
Is this ok [y/N]: y
Downloading Packages:
wget-1.11.4-2.el5_4.1.i386.rpm                                               | 582 kB     00:04
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : wget                                                                         1/1

Installed:
  wget.i386 0:1.11.4-2.el5_4.1

Complete!