File Formats netrc(4)
netrc - file for ftp remote login data
The .netrc file contains data for logging in to a remote
host over the network for file transfers by ftp(1). This
file resides in the user's home directory on the machine
initiating the file transfer. Its permissions should be set
to disallow read access by group and others (see chmod(1)).
The following tokens are recognized; they may be separated
by SPACE, TAB, or NEWLINE characters:
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 com-
mand line or as an open command argument. Once a match
is made, the subsequent .netrc tokens are processed,
stopping when the EOF is reached or another machine
token is encountered.
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. The default token is nor-
mally used as follows:
default login anonymous password user@site
Such an entry gives the user automatic anonymous ftp
login to machines not specified in .netrc.
Identify a user on the remote machine. If this token
is present, the auto-login process will initiate a
login using the specified name.
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: if this token is present in the
.netrc file, ftp will abort the auto-login process if
the .netrc is readable by anyone besides the user.
Supply an additional account password. If this token
is present, the auto-login process supplies the speci-
fied string if the remote server requires an
SunOS 5.9 Last change: 3 Jul 1990 1
File Formats netrc(4)
additional account password. If the remote server does
not require an additional account password, the auto-
login process will initiate an ACCT command.
Define a macro. This token functions the same as ftp
macdef. A macro is defined with the specified name;
its contents begin with the next .netrc line and con-
tinue until a null line (consecutive NEWLINE charac-
ters) is encountered. If a macro named init is
defined, it is automatically executed as the last step
in the auto-login process.
Example 1: A Sample .netrc File
A .netrc file containing the following line:
machine ray login demo password mypassword
allows an autologin to the machine ray using the login name
demo with password mypassword.
chmod(1), ftp(1), in.ftpd(1M)
SunOS 5.9 Last change: 3 Jul 1990 2