HP-UX Reference (11i v2 04/09) - 4 File Formats (vol 8)
n
netrc(4) netrc(4)
NAME
netrc: .netrc - login information for ftp, rexec, and rexec()
DESCRIPTION
The
.netrc file contains login and initialization information used by the
ftp autologin process, by the
rexec() library routine, and by the rexec
command (see ftp (1), rexec (3N), and remsh(1)), respectively.
This file is optional. It exists, if at all, in the user’s home directory.
If the
.netrc file contains password or account information for use other than for anonymous
ftp, its
owner must match the effective user ID of the current process. Its read, write, and execute mode bits for
group and other must all be zero, and it must be readable by its owner. Otherwise, the file is ignored.
The file can contain the following tokens, separated by white space (spaces, tabs, or newlines) or commas
(
,). To include a comma as part of a token, enclose that token in quotation marks (
").
machine name Identify a remote machine name. The autologin process searches the
.netrc
file for a machine token that matches the remote machine specified on the
ftp command line, as an ftp open
command argument, or as the *ahost
parameter to
rexec(). Once a match is made, the subsequent
.netrc
tokens are processed, stopping when the end-of-file is reached or another
machine token or a default token is encountered.
If the remote machine name has an alias hostname, and both the official host-
name and the alias are present in the
.netrc file, the ftp client gives pre-
cedence to the official hostname over the alias when searching the .netrc
file. If an alias is given as an entry to the ftp open command, and in the
search from the top of the .netrc file to the bottom, the ftp client finds the
alias hostname before it finds the official hostname, it will use the alias’s entry.
However, if it finds the official hostname first it will use the official entry even
though the alias hostname also exists in the .netrc file. So the high pre-
cedence given to the official hostname requires placing the official hostname
entry last in the .netrc file for ftp when aliases exist.
default 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 for ftp as follows:
default login anonymous password user@site
This provides automatic anonymous ftp login to machines not specified in
.netrc. This can be overridden in ftp by using the -n flag to disable auto-
login.
login name Identify a user on the remote machine. If this token is present, the ftp
or
rexec() autologin process initiates a login using the specified name. If this
token matches the user name used by the rexec -l command option, or, by
default, the local user name, rexec uses the password token, if present.
password string Supply a password. If this token is present, the autologin process supplies 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 aborts the autologin process if the .netrc is
readable by anyone other than the owner. Also note that the passwords in
.netrc are not encrypted.
account string Supply an additional account password for ftp login. If this token is present,
the autologin process supplies the specified string if the remote server requires
an additional account password, or the autologin process initiates an acct
command if it does not.
macdef name Define an ftp macro. This token is just like the ftp macdef command. A
macro is defined with the specified name; its contents begin with the next
.netrc line and continue until an empty line (consecutive newline charac-
ters) is encountered. If a macro named init is defined, it is automatically
executed as the last step in the ftp autologin process.
HP-UX 11i Version 2: September 2004 − 1 − Hewlett-Packard Company Section 4−−207