setup~1.ano

来自「操作系统源代码」· ANO 代码 · 共 75 行

ANO
75
字号
#!/bin/sh# setup.anonftp - Anonymous FTP setup and maintenance.## 01/22/96 Initial Release	Al Woodhul, <asw@hampshire.edu># 01/25/96			Michael Temari, <temari@ix.netcom.com>## What is needed for anon ftp# ref: Hunt TCP/IP Net Admin pp. 338++# ref: Nemeth et al UNIX System Admin Handbook p. 295# ref: mail from M. Temari 18.01.96# programs possibly used by ftpdPROGS="sh ls crc tar compress gzip"echo Checking /etc/passwdif grep '^ftp:[^:]*:[1-9][0-9]*:[1-9][0-9]*:[^:]*:/[^:]*:[^:]*$' \						/etc/passwd >/dev/nullthen  echo -n "OK, ftp entry found: "  grep '^ftp:' /etc/passwdelse  echo "Found no entry for ftp in /etc/passwd, please add one with the"  echo "home directory pointing to the anonymous FTP directory"  exit 1fi# ftp directoryFTPDIR="`sed '/^ftp:/!d; s/^.*:\\([^:]*\\):[^:]*/\\1/' /etc/passwd`"if [ `whoami` != root ]then  echo You must be root to do this  exit 1fiecho Setting up for anonymous ftpecho Making $FTPDIR and subdirectoriesinstall -d -m 755 -o root -g operator $FTPDIRinstall -d -m 751 -o root -g operator $FTPDIR/bininstall -d -m 751 -o root -g operator $FTPDIR/devinstall -d -m 751 -o root -g operator $FTPDIR/etcinstall -d -m 755 -o root -g operator $FTPDIR/pubincoming=if [ -d $FTPDIR/pub/incoming ]then	incoming=telif [ -t 0 ]then	echo -n "Create \"incoming\" directory? [n] "; read yn	case "$yn" in	[yY]*|ok|sure)	incoming=t	esacfitest "$incoming" && install -d -m 777 -o root -g operator $FTPDIR/pub/incomingecho Copying filesfor PROG in $PROGSdo  test -f /usr/bin/$PROG && install -lcs /usr/bin/$PROG $FTPDIR/bindonecp -rp /dev/tcp $FTPDIR/dev/tcpecho Copying a minimum of the password and group filessed 's/^\([^:]*\):[^:]*:\([^:]*:[^:]*\):.*$/\1:*:\2:::/' \					/etc/passwd >$FTPDIR/etc/passwdsed 's/^\([^:]*\):[^:]*:\([^:]*\):.*$/\1:*:\2:/' \					/etc/group >$FTPDIR/etc/groupchown root:operator $FTPDIR/etc/*chmod 444 $FTPDIR/etc/*echo "Anonymous ftp setup complete"

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?