.netrc File Format for TCP/IP

Purpose

Specifies automatic login information for the ftp and rexec commands.

Description

The $HOME/.netrc file contains information used by the automatic login feature of the rexec and ftp commands. It is a hidden file in a user's home directory and must be owned either by the user executing the command or by the root user. If the .netrc file contains a login password, the file's permissions must be set to 600 (read and write by owner only). This file is part of TCP/IP in Network Support Facilities.

Note: The .netrc file is not used by any programs when the securetcpip command is running on your system.

The .netrc can contain the following entries (separated by spaces, tabs, or new lines):

Item Description
machine HostName The HostName variable is the name of a remote host. This entry begins the definition of the automatic login process for the specified host. All following entries up to the next machine entry or the end of the file apply to that host.
default The default variable is the same as machine except that default matches any name. There can be only one default entry. It must be the last entry (after all machine entries); otherwise, entries that follow it will be ignored. This is normally used as:
default login anonymous password user@site

thereby giving the user automatic anonymous ftp login to machines not specified in the .netrc file. This can be overridden by using the -n flag to disable the auto-login.

login UserName The UserName variable is the full domain user name for use at the remote host. If this entry is found, the automatic login process initiates a login, using the specified name. If this entry is missing, the automatic login process is unsuccessful.
password Password The Password variable is the login password to be used. The automatic login process supplies this password to the remote server. A login password must be established at the remote host, and that password must be entered in the .netrc file. Otherwise the automatic login process is unsuccessful, and the user is prompted for the login password.
Note: You cannot use a space when you enter the password.
account Password The Password variable is the account password to be used. If this entry is found and an account password is required at the remote host, the automatic login process supplies the password to the remote server. If the remote host requires an account password but this entry is missing, the automatic login process prompts for the account password.
macdef MacroName The MacroName variable is the name of an ftp subcommand macro. The macro is defined to contain all of the following ftp subcommands up to the next blank line or the end of the file. If the macro is named init, the ftp command executes the macro upon successful completion of the automatic login process. The rexec command does not recognize a macdef entry.

Examples

The following is an example of an entry in a .netrc file:

machine host1.austin.century.com login fred password bluebonnet

Files

Item Description
/usr/samples/tcpip/netrc Sample .netrc file