Problem
How do I set up guest ftp on my server?
Solution
The "ftpd(ADMN)" server started by the super server "inetd(ADMN)" supports three types of accounts:
Anonymous
Real
GuestThe anonymous account allows any user to log in to the ftp (File Transfer Protocol) server using the username 'anonymous' or 'ftp' and a password consisting of their email address. Although effectively anyone can use the account, because a chroot(S) is done, access is limited to files in the ftp user's home directory tree.
Real accounts which allow users to log in directly to the ftp server system with a pre-assigned username and password can also be used to log in to the ftp server. When logged in to the ftp server, access to files is the same as if the user logged in directly. This is the "usual" method of ftp.
Guest accounts' ftp allow a user to log in with a preassigned username and password like real accounts, but are restricted to what files they can access, similar to the anonymous account. Effectively, they are passworded anonymous ftp accounts.
The following is an example only of how to set up a guest ftp account for the user "client1".
Example:(a) Create a UNIX group called "guests".
As "root" run SCOadmin and use the Account Manager to create the new group.
# pg /etc/group...
...
guests::506:(b) Again using SCOadmin, create a user called "client1".
Add this user to the new group "guests" and make the default login group the same.
Change the users login shell to "/bin/false". A drop down option may not be seen but the choice can be input by deleting the default and typing the shell.
Make the user "local" only and add the account to the new group.
Make the home directory "/usr/guests/client1" (or "/usr/guests/./client1" to avoid having to edit "/etc/passwd" later on).
Set a password.The user account should be set up as follows:
# pg /etc/passwd...
...
client1:x:31017:506:Guest ftp account:/usr/guests/client1:
/bin/false
...Make a copy of the "/etc/passwd" file in case of editing errors. Then, as "root", edit the line so that it appears as follows:
client1:x:31017:506:Guest ftp account:/usr/guests/./client1:
/bin/falseA "./" has been inserted. The directory "/usr/guests" represents where the ftp server will chroot(S) to on user login and chdir(S) to "/client1". Effectively users "see" their current directory as the top of the UNIX tree, that is, ftp> cd / will put them into "/" but this will actually be "/usr/guests" on the system.
The "/etc/group" entry for guests should now appear as follows:
guests::506:client1(c) As "root", edit the file "/etc/shells" and add:
/bin/false(d) Edit the "/etc/ftpaccess" file.Add the following line to the end of the file:
guestgroup guests(e) On ftp login, the guest user will be forced into their
home directory on the system. In order to give the usual ftp
functionality, certain files are required to be present in the
directory structure. The directory structure is set up as per
anonymous ftp. See the online SCO documentation for this
configuration.For both anonymous and guests accounts the required system files must be copied into the directory where they have been chroot(S)'d. In the case of anonymous ftp, this is the "/usr/ftp" directory which also happens to be the account home directory. For the guest account it is different. The chroot(S) account is "/usr/guests" and the chdir(S) directory is /client1, not the usual home directory. In this case the files are placed in "/usr/guests". It also allows new guest accounts to be created while having the system files required already set up.
The home directory was created with chmod(C) permissions 755:
...
drwxr-xr-x 2 client1 guests 512 Jun 25 17:13 client1
...As the "root" user:# cd /usr/guests
# chmod 755 .;chown root .; chgrp root .
# mkdir bin dev etc lib usr usr/lib
# chown root bin etc dev lib usr usr/lib
# chmod 555 bin etc dev lib usr usr/lib
# cd bin
# cp /bin/ls .
# chmod 111 ls
# cd ../etc
# cp /etc/passwd .
# cp /etc/group .
# chmod 444 passwd group
# cd ../lib
# cp /lib/libprot.so.1 .
# chmod 555 lib*
# chown bin lib*
# cd ../usr/lib
# cp /usr/lib/libc.so.1 .
# cp /usr/lib/libsocket.so.1 . /* This is for 5.0.0-5.0.5
# cp /usr/lib/libsocket.so.2 . /* This is for 5.0.6a-5.0.7, or
for systems patched with
oss646c */
# chmod 555 lib*
# chown bin lib*
# cd ../..
# find /dev/socksys -print |cpio -dumpv /usr/guests
0 blocks
# find /dev/zero -print | cpio -dumpv /usr/guests
0 blocksNo "pub" directory was created for anonymous ftp.
(f) Finally, test the connection.$ ftp scotest
Connected to scotest.sprog.sco.com.
220-
220 scotest FTP server (Version 2.1WU(1)) ready.
Name (scotest:fred): client1
331 Password required for client1.
Password:
230 Guest login ok, send e-mail address as password.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> pwd
257 "/client1" is current directory.
ftp>
...
...NOTE: If an entry has not been added to "/etc/shells", a "530: User
client1 Access Denied" error may be seen on attempted login. To
check this and other possible problems, the ftpd(ADMN) server
process can be set to write debug information to the system
"/usr/adm/syslog" file using the "-d" flag. Logging information
can be set using the "-l" flag. For example, the "Access Denied"
error above is seen as "FTP LOGIN REFUSED (bad shell)". Edit the
system "/etc/inetd.conf" file, add "-l" after ftpd (last field)
and force the inetd process to re-read its configuration file by
sending it a SIGHUP signal with the command:# kill -1 <PID)where "PID" is the process ID of /etc/inetd shown in "ps -ef |grep
inetd".If the supporting system files are placed in the wrong location, the ftp login may indeed work, but "ls" may not report anything present in the directory or other commands may not work properly.
NOTE: The same procedure can also be used with UnixWare7 and Open UNIX 8
or alternatively use the "scoadmin ftp" function. See:http://uw713doc.sco.com/en/NET_tcpip/ftpC.manager.htmlNOTE: To restrict the ftp users from accessing the system directories run# chmod 111 bin dev etc usrUsers are then not able to see the contents of these directories.
NOTE: To set up general anonymous FTP access:For OpenServer 5.0.6:http://osr5doc.ca.sco.com:457/NetAdminG/tcpT.anonymous_ftp_setup.htmlFor OpenServer 5.0.7:http://docsrv.sco.com:507/en/NetAdminG/tcpT.anonymous_ftp_setup.htmlNOTE: To administer your FTP Server, try this routine for deleting files
over 180 days old for example, with the exception of certain areas:---- cut here ----
#! /bin/sh
#
# script to trim temporary files older than 6 months from ftp
#FTPHOME=/home/ftp
TMP=$FTPHOME/tmp
INC=$FTPHOME/incoming
EXCLUDE="tmp/save/"
RMLIST=/tmp/rmlist.$$AGE=$1 if [ "$AGE" = "" ]; then AGE=180 fi
find $INC -mtime +$AGE > $RMLIST
find $TMP -mtime +$AGE >> $RMLIST
IFS='
'
for file in `cat $RMLIST|grep -v "$EXCLUDE"`
do
# rm -fr "$file"
echo "$file"
done
# rm $RMLIST
---- cut here ----To remove the files, remove the remark from the "rm" commands. You may wish to remark the "echo" command.
Alternatively, this script could be added to root's crontab so that the cleanup was done automatically, periodically.
TROUBLESHOOTING:Clients cannot ftp to the server. The file /usr/adm/syslog shows the
message:ftpd[790]:FTP LOGIN REFUSED (/usr/internet/ip/0.0.0.0/sco_ftp : not accessible)To resolve this issue, take these steps:
1. Determine the home directory of the ftp account in the /etc/passwd
file. For example, "/u/ftp".2. Create a symbolic link that points to the proper directory:
mkdir -p /usr/internet/ip/0.0.0.0 (if it does not exist)rm /usr/internet/ip/0.0.0.0/sco_ftp (if it exists)ln -s /u/ftp /usr/internet/ip/0.0.0.0/sco_ftp See also
man pages ftpd(ADMN), ftpaccess(SFF)SCO OpenServer 5 Networking Guide, Chapter 3, "Setting up anonymous ftp".