Ftp Automatic Login

Wednesday, December 10, 2008

Ftp Automatic Login

FtpHow do you use ftp in Unix CLI?

You will give ftp hostname/ip.
It will take you to the ftp> prompt.
Now you will give subcommands like login, cd, get, delete etc.

You always need to login by giving username and password in the login subcommand. Have you tried automatic login method? It is in ftp.

The .netrc file

First you need a file .netrc in your home directory. In the file, you need to enter the username and password to be used with each host.

Example line in .netrc :
machine <remote machine> login <remote username> password <remote password>

Set the mode for the file to 400, ie. chmod 400 ~/.netrc

Using ftp automatic login

Just give ftp hostname/ip, if the hostname is present in .netrc, ftp will use the information and automatically login for you.

To avoid using the .netrc file, just use ftp -u hostname/ip.

 See also... » 10.1 Linux Commands I Can't Live Without

» Linux Commands I Hardly Knew

ATOzTOA : Latest Headlines


Post a Comment