NAME [Toc] [Back]
netrc - login information for ftp and rexec
DESCRIPTION [Toc] [Back]
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
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 hostname and
the alias are present in the .netrc file, the
ftp client gives precedence 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 precedence given to
the official hostname requires placing the
official hostname entry last in the .netrc
file for ftp when aliases exist.
Hewlett-Packard Company - 1 - HP-UX 11i Version 2: August 2003
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 autologin.
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
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
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
characters) is encountered. If a macro named
init is defined, it is automatically executed
as the last step in the ftp autologin
Hewlett-Packard Company - 2 - HP-UX 11i Version 2: August 2003
EXAMPLES [Toc] [Back]
The following is a valid entry for the host hpxdzg whose guest account
has the password sesame:
machine hpxdzg login guest password sesame
WARNINGS [Toc] [Back]
It is a security risk to have unencrypted passwords in a file.
AUTHOR [Toc] [Back]
netrc was developed by the University of California, Berkeley.
FILES [Toc] [Back]
SEE ALSO [Toc] [Back]
ftp(1), remsh(1), rexec(3N).
Hewlett-Packard Company - 3 - HP-UX 11i Version 2: August 2003 [ Back ]