Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ftp(1c)

netrc(5)

Name

netrc − file used by ftp auto-login procedure (.netrc)

Description

The .netrc file contains frequently needed options for ftp transfers. The file resides in the owner’s home directory on the machine from which the owner initiates the file transfer. If the file includes passwords, set permissions on the file with chmod() so that only the owner has read permission.

The .netrc file uses the following format:

•Each line of the .netrc file defines options for a specific machine.

•A line in the .netrc file can be either a machine line or a default line.

•The default line must be the first line in the file if it is present. 

•Fields in a default line appear in this order: default, default machine name. 

•Fields in a machine line appear in this order: machine, machine name, options. 

•Fields on each line are separated by spaces or tabs. 

The following are valid options for a machine line:

Option Parameter Default Description
machine machine name none Identifies a remote
machine name
login name local name Identifies user on the
remote machine
password password none Password for remote
login name
account password none Additional account password
macdef macro name none Defines a macro like the
ftp macdef command

Example

This is an example of a .netrc file:

machine cactus login smith
machine nic.ddn.mil login anonymous password anonymous
machine palm.stateu.edu login smith password ualonerwelcome
macdef byenow
quit
 macdef ls
dir
 

The first line allows ftp to log Smith into the machine cactus after prompting for and receiving Smith’s password, as shown in this example:

$ ftp cactus
Connected to cactus.tech.edu
FTP server ready.
Password required for SMITH.
User logged in
ftp>

The second line of the file allows the user to perform an anonymous ftp transfer after typing this command:

$ ftp nic.ddn.mil

See ftp() for a description of anonymous FTP transfers.

The third line allows Smith to log into the machine palm.stateu.edu. Smith will not be prompted for a password because this machine line includes password information.  Because the .netrc file includes password information, the file must not have read permission set for world and group.

The macdef lines are macro definitions, which operate much like shell aliases. A blank line must follow each macro definition to signal the end of the macro. The first macro definition defines byenow as an alias for the ftp quit command.

See Also

ftp(1c)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026