Using Internet Services

24 Chapter3
Transferring Files with ftp
Setting Up Automatic Remote Login for ftp
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 useful for programs that need to perform ftp operations
unattended. Follow these steps:
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 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 make sure that your .netrc file is
owned by you, the user:
ls -l .netrc
3. Issue the following command to protect your .netrc file so 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 so that no one else
can write to it:
chmod 0755
your_home_directory
For more information, type man 4 netrc at the HP-UX prompt.
CAUTION The .netrc file creates a security risk. Passwords in this file are
unencrypted.