2 # setup.anonftp - Anonymous FTP setup and maintenance.
4 # 01/22/96 Initial Release Al Woodhul, <asw@hampshire.edu>
5 # 01/25/96 Michael Temari, <temari@ix.netcom.com>
8 # What is needed for anon ftp
10 # ref: Hunt TCP/IP Net Admin pp. 338++
11 # ref: Nemeth et al UNIX System Admin Handbook p. 295
12 # ref: mail from M. Temari 18.01.96
14 # programs possibly used by ftpd
15 PROGS
="sh ls crc tar compress gzip"
17 echo Checking
/etc
/passwd
18 if grep '^ftp:[^:]*:[1-9][0-9]*:[1-9][0-9]*:[^:]*:/[^:]*:[^:]*$' \
19 /etc
/passwd
>/dev
/null
21 echo -n "OK, ftp entry found: "
22 grep '^ftp:' /etc
/passwd
24 echo "Found no entry for ftp in /etc/passwd, please add one with the"
25 echo "home directory pointing to the anonymous FTP directory"
30 FTPDIR
="`sed '/^ftp:/!d; s/^.*:\\([^:]*\\):[^:]*/\\1/' /etc/passwd`"
32 if [ `whoami` != root
]
34 echo You must be root to
do this
38 echo Setting up
for anonymous
ftp
40 echo Making
$FTPDIR and subdirectories
41 install -d -m 755 -o root
-g operator
$FTPDIR
42 install -d -m 751 -o root
-g operator
$FTPDIR/bin
43 install -d -m 751 -o root
-g operator
$FTPDIR/dev
44 install -d -m 751 -o root
-g operator
$FTPDIR/etc
45 install -d -m 755 -o root
-g operator
$FTPDIR/pub
47 if [ -d $FTPDIR/pub
/incoming
]
52 echo -n "Create \"incoming\" directory? [n] "; read yn
54 [yY
]*|ok|sure
) incoming
=t
57 test "$incoming" && install -d -m 777 -o root
-g operator
$FTPDIR/pub
/incoming
62 test -f /usr
/bin
/$PROG && install -lcs /usr
/bin
/$PROG $FTPDIR/bin
64 cp -rp /dev
/tcp
$FTPDIR/dev
/tcp
65 install -lcs ftpdsh
$FTPDIR/bin
67 echo Copying a minimum of the password and group files
68 sed 's/^\([^:]*\):[^:]*:\([^:]*:[^:]*\):.*$/\1:*:\2:::/' \
69 /etc
/passwd
>$FTPDIR/etc
/passwd
70 sed 's/^\([^:]*\):[^:]*:\([^:]*\):.*$/\1:*:\2:/' \
71 /etc
/group
>$FTPDIR/etc
/group
72 chown root
:operator
$FTPDIR/etc
/*
73 chmod 444 $FTPDIR/etc
/*
75 echo "Anonymous ftp setup complete"