Using HP-UX Internet Services (August 2003)

Transferring Files with ftp
Setting Up Automatic Remote Login for ftp
Chapter 330
Setting Up Automatic Remote Login for ftp
If you have an account on a remote host, you can create a .netrc file in
your local home directory that allows you to log into the remote host
without supplying your remote login name and password. The .netrc
file can be used for programs that need to perform ftp operations
unattended.
The following steps describe how to create the .netrc file on the local
host:
1. Create a file called .netrc in your home directory on the local host, if
it does not already exist, and add the following line to it:
machine
host_name
login
login_name
password
password
The following example allows you to use ftp to log into the host
basil as user andy without supplying the user name or the
password, which is pre10der.
machine basil login andy password pre10der
2. Issue the following command to ensure that you are the owner of the
.netrc file:
ls -l .netrc
3. Issue the following command to protect your .netrc file so that only
you can read it:
chmod 0400 .netrc
4. Move to the parent directory of your home directory, and issue the
following command to protect your home directory by restricting
write permission to other users (that is, group and others):
chmod 0755
your_home_directory
For more information, type man 4 netrc at the HP-UX prompt.
IMPORTANT The .netrc file creates a security risk because the password in this file is
not encrypted.