加入以下資料在 /etc/passwd
ftp:x:
加入以下資料在 /etc/shadow
ftp:NP:
以下shell script用來設定anonymous ftp area
把以下內容放入 /etc/ftpanonymous
#!/bin/sh
# script to setup anonymous ftp area
#
# verify you are root
/usr/bin/id | grep
if [
echo
exit
fi
# handle the optional command line argument
case $# in
# the default location for the anon ftp comes from the passwd file
;;
ftphome=
else
ftphome=$
fi
;;
*) echo
exit
;;
esac
if [
echo
exit
fi
case ${ftphome} in
/*) # ok
;;
*) echo
exit
;;
esac
# This script assumes that ftphome is neither / nor /usr so
if [
echo
exit
fi
# If ftphome does not exist but parent does
if [ !
# lack of
mkdir ${ftphome}
fi
chown root ${ftphome}
chmod
echo Setting up anonymous ftp area ${ftphome}
# Ensure that the /usr directory exists
if [ !
mkdir
fi
# Now set the ownership and modes to match the man page
chown root ${ftphome}/usr
chmod
# Ensure that the /usr/bin directory exists
if [ !
mkdir
fi
# Now set the ownership and modes to match the man page
chown root ${ftphome}/usr/bin
chmod
# this may not be the right thing to do
# but we need the bin
rm
ln
# Ensure that the /usr/lib and /etc directories exist
if [ !
mkdir
fi
chown root ${ftphome}/usr/lib
chmod
if [ !
mkdir
fi
chown root ${ftphome}/usr/lib/security
chmod
if [ !
mkdir
fi
chown root ${ftphome}/etc
chmod
# a list of all the commands that should be copied to ${ftphome}/usr/bin
# /usr/bin/ls is needed at a minimum
ftpcmd=
# ${ftphome}/usr/lib needs to have all the libraries needed by the above
# commands
# to resolve names
ftplib=
ftplib=
ftplib=
ftplib=
cp ${ftplib} ${ftphome}/usr/lib
chmod
cp /usr/lib/security/* ${ftphome}/usr/lib/security
chmod
cp ${ftpcmd} ${ftphome}/usr/bin
chmod
# you also might want to have separate minimal versions of passwd and group
cp /etc/passwd /etc/group /etc/netconfig /etc/nf ${ftphome}/etc
chmod
# need /etc/default/init for timezone to be correct
if [ !
mkdir ${ftphome}/etc/default
fi
chown root ${ftphome}/etc/default
chmod
cp /etc/default/init ${ftphome}/etc/default
chmod
# Copy timezone database
mkdir
(cd ${ftphome}/usr/share/lib/zoneinfo
(cd /usr/share/lib/zoneinfo; find
cpio
find
find
)
# Ensure that the /dev directory exists
if [ !
mkdir
fi
# make device nodes
#
for device in zero tcp udp ticotsord ticlts
do
line=`ls
major=`echo $line | awk
minor=`echo $line | awk
rm
mknod ${ftphome}/dev/${device} c ${major} ${minor}
done
chmod
## Now set the ownership and modes
chown root ${ftphome}/dev
chmod
# uncomment the below if you want a place for people to store things
# but beware the security implications
#if [ !
# mkdir
#fi
#chown root ${ftphome}/pub
#chmod
# chmod
# /etc/ftpanonymous ( 執行ftpanonymous )
# cd ~ftp/etc <
完成
From:http://tw.wingwit.com/Article/program/Java/Javascript/201311/25428.html