source: trunk/minix/commands/ftpd200/setup.anonftp@ 10

Last change on this file since 10 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 2.0 KB
Line 
1#!/bin/sh
2# setup.anonftp - Anonymous FTP setup and maintenance.
3#
4# 01/22/96 Initial Release Al Woodhul, <asw@hampshire.edu>
5# 01/25/96 Michael Temari, <temari@ix.netcom.com>
6#
7
8# What is needed for anon ftp
9
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
13
14# programs possibly used by ftpd
15PROGS="sh ls crc tar compress gzip"
16
17echo Checking /etc/passwd
18if grep '^ftp:[^:]*:[1-9][0-9]*:[1-9][0-9]*:[^:]*:/[^:]*:[^:]*$' \
19 /etc/passwd >/dev/null
20then
21 echo -n "OK, ftp entry found: "
22 grep '^ftp:' /etc/passwd
23else
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"
26 exit 1
27fi
28
29# ftp directory
30FTPDIR="`sed '/^ftp:/!d; s/^.*:\\([^:]*\\):[^:]*/\\1/' /etc/passwd`"
31
32if [ `whoami` != root ]
33then
34 echo You must be root to do this
35 exit 1
36fi
37
38echo Setting up for anonymous ftp
39
40echo Making $FTPDIR and subdirectories
41install -d -m 755 -o root -g operator $FTPDIR
42install -d -m 751 -o root -g operator $FTPDIR/bin
43install -d -m 751 -o root -g operator $FTPDIR/dev
44install -d -m 751 -o root -g operator $FTPDIR/etc
45install -d -m 755 -o root -g operator $FTPDIR/pub
46incoming=
47if [ -d $FTPDIR/pub/incoming ]
48then
49 incoming=t
50elif [ -t 0 ]
51then
52 echo -n "Create \"incoming\" directory? [n] "; read yn
53 case "$yn" in
54 [yY]*|ok|sure) incoming=t
55 esac
56fi
57test "$incoming" && install -d -m 777 -o root -g operator $FTPDIR/pub/incoming
58
59echo Copying files
60for PROG in $PROGS
61do
62 test -f /usr/bin/$PROG && install -lcs /usr/bin/$PROG $FTPDIR/bin
63done
64cp -rp /dev/tcp $FTPDIR/dev/tcp
65install -lcs ftpdsh $FTPDIR/bin
66
67echo Copying a minimum of the password and group files
68sed 's/^\([^:]*\):[^:]*:\([^:]*:[^:]*\):.*$/\1:*:\2:::/' \
69 /etc/passwd >$FTPDIR/etc/passwd
70sed 's/^\([^:]*\):[^:]*:\([^:]*\):.*$/\1:*:\2:/' \
71 /etc/group >$FTPDIR/etc/group
72chown root:operator $FTPDIR/etc/*
73chmod 444 $FTPDIR/etc/*
74
75echo "Anonymous ftp setup complete"
Note: See TracBrowser for help on using the repository browser.