Anonymous ftp allows a user without a login on your host to
transfer files to and from a public directory. A user types the ftp command to connect to your host and types anonymous or ftp as a login name. The user can type any string
of characters as a password. (By convention, the password is the
host name of the user's host). The anonymous user is then
given access only to user ftp's home directory, usually called /home/ftp.
Configuring anonymous ftp access involves the following tasks, described
in this section:
You can follow the instructions in this section, or you can
use SAM to configure anonymous ftp access. SAM (System Administration Manager) is
the Hewlett-Packard windows-based user interface for performing
system administration tasks. To run SAM, type sam at the HP-UX prompt. SAM has an extensive online
help facility.
To Add User ftp to
/etc/passwd |
|
Use a text editor to add a line for user ftp to the /etc/passwd file, as in the following example:
ftp:*:500:guest:anonymous ftp:/home/ftp:/usr/bin/false
|
The password field should be *, the group membership should
be guest, and the login shell should be /usr/bin/false. In this example, user ftp's user ID is 500, and the anonymous ftp directory is /home/ftp.
Type man 4 passwd at the HP-UX prompt for information on the passwd file.
To Create the Anonymous
ftp Directory |
|
Create the ftp home directory that you configured in the /etc/passwd file, as in the following example:
Create the subdirectory /usr/bin under the ftp home directory:
cd /home/ftp mkdir usr cd usr mkdir bin
|
Copy the ls and pwd commands from /sbin to ~ftp/usr/bin, and set the permissions on the commands to 0111
(executable only):
cp /sbin/ls /home/ftp/usr/bin cp /sbin/pwd /home/ftp/usr/bin chmod 0111 /home/ftp/usr/bin/ls chmod 0111 /home/ftp/usr/bin/pwd
|
Set the owner of the ~ftp/usr/bin and ~ftp/usr directories to root, and set the permissions to 0555 (not writeable):
chown root /home/ftp/usr/bin chmod 0555 /home/ftp/usr/bin chown root /home/ftp/usr chmod 0555 /home/ftp/usr
|
Create the subdirectory etc under the ftp home directory:
Copy /etc/passwd and /etc/group to ~ftp/etc. These files are required by the ls command, to display the owners of files and directories
under ~ftp.
cp /etc/passwd /home/ftp/etc cp /etc/group /home/ftp/etc
|
Replace the password field in all entries in /home/ftp/etc/passwd with *, and delete the shell field from the end
of each entry:
ftp:*:500:guest:anonymous ftp:/home/ftp: acb:*:8996:20::/home/acb:
|
Replace the password field in all entries in /home/ftp/etc/group with *:
users:*:20:acb guest:*:21:ftp
|
Set the owner of the files in ~ftp/etc to root, and set the permissions to 0444 (read only):
chown root /home/ftp/etc/passwd chmod 0444 /home/ftp/etc/passwd chown root /home/ftp/etc/group chmod 0444 /home/ftp/etc/group
|
Set the owner of ~ftp/etc to root, and set the permissions to 0555 (not writeable):
chown root /home/ftp/etc chmod 0555 /home/ftp/etc
|
Create a directory called pub under ~ftp. Set its owner to user ftp and its permissions to 0777 (writeable by all).
Anonymous ftp users can put files in this directory to make
them available to other anonymous ftp users.
mkdir /home/ftp/pub chown ftp /home/ftp/pub chmod 0777 /home/ftp/pub
|
Create a directory called dist under ~ftp. Set its owner to user root and its permissions to 0755 (writeable only by root). The superuser can put read-only files in this
directory to make them available to anonymous ftp users.
mkdir /home/ftp/dist chown root /home/ftp/dist chmod 0755 /home/ftp/dist
|
Set the owner of user ftp's home directory to root and the permissions to 0555 (not writeable).
chown root /home/ftp chmod 0555 /home/ftp
|
An anonymous ftp directory has the structure shown in Figure 2-1 “Directory Structure
for Anonymous ftp Account”: