The '.netrc' file is used by the FTP program to automatically log a user into
an ftp server without prompting the user for their username or password. This
is particularyly useful for anonymous login sites if your often log into
these type of sites.
#.netrc
machine ftp.machine.org login PASSWORD
machine ftp.ftpserver.com login PASSWORD
default login anonymous password user@site
The default will match any machine not listed in the entrys above. That will
usually be an anonymous ftp server. If, however you want to log into a
machine not listed but have an account and don't want to use the default
anonymous login specified above, you will call the FTP program with the flag
'-n' flag which specifies not to use the '.netrc' file.
% ftp -n ftp.hostname.com
> user USERNAME PASSWORD
The following information is from the 'ftp' manual (man ftp):
THE .netrc FILE
The .netrc file contains login and initialization information used
by the auto-login process. It resides in the user's home directory.
The following tokens are recognized; they may be separated by spaces,
tabs, or new-lines:
machine name
Identify a remote machine name. The auto-login process
searches the .netrc file for a machine token that matches
the remote machine specified on the ftp command line or as
an open command argument. Once a match is made, the
subsequent .netrc tokens are processed, stopping when the
end of file is reached or another machine or a default token
is encountered.
default
This is the same as machine name except that default matches
any name. There can be only one default token, and it must be
after all machine tokens. This is normally used as:
default login anonymous password user@site
thereby giving the user automatic anonymous ftp login to
machines not specified in .netrc. This can be overridden
by using the -n flag to disable auto-login.
login name
Identify a user on the remote machine. If this token is
present, the auto-login process will initiate a login using
the specified name.
password string
Supply a password. If this token is present, the auto-login
process will supply the specified string if the remote server
requires a password as part of the login process. Note that
if this token is present in the .netrc file for any user
other than anonymous, ftp will abort the auto-login process
if the .netrc is readable by anyone besides the user.
account string
Supply an additional account password. If this token is
present, the auto-login process will supply the specified
string if the remote server requires an additional account
password, or the auto-login process will initiate an ACCT
command if it does not.