BBS水木清华站∶精华区

发信人: midi (迷笛), 信区: Unix 
标  题: Re: 怎样在Solaris 2.5上建anonymous ftp? 
发信站: BBS 水木清华站 (Mon Jan  6 09:42:58 1997) 
 
【 在 yan70 (cat) 的大作中提到: 】 
 我是个新手,而且比较笨,请详细指教,! 
 我这里先谢谢了! 
 
 
两种方法: 
1. 利用Solaris 2.4本身的in.ftpd或ftpd建立Anonymous FTP Daemon。 
你可以man ftpd来查询具体内容,也可以利用下面程序自动建立。 
 
     #!/bin/sh 
     # script to setup SunOS 5.3 anonymous ftp area 
     # 
 
     # handle the optional command line argument 
     case $# in 
 
        # the default location for the anon ftp comes from the passwd file 
        0) ftphome="`grep '^ftp:' /etc/passwd | cut -d: -f6`" 
           ;; 
 
        1) if [ "$1" = "start" ]; then 
              ftphome="`grep '^ftp:' /etc/passwd | cut -d: -f6`" 
           else 
              ftphome=$1 
           fi 
           ;; 
 
        *) echo "Usage: $0 [anon-ftp-root]" 
           exit 1 
           ;; 
     esac 
 
     if [ -z "${ftphome}" ]; then 
        echo "$0: ftphome must be non-null" 
        exit 2 
     fi 
 
     # This script assumes that ftphome is neither / nor /usr so ... 
     if [ "${ftphome}" = "/" -o "${ftphome}" = "/usr" ]; then 
        echo "$0: ftphome must not be / or /usr" 
        exit 2 
     fi 
 
     # If ftphome does not exist but parent does, create ftphome 
     if [ ! -d ${ftphome} ]; then 
         # lack of -p below is intentional 
         mkdir ${ftphome} 
     fi 
 
     echo Setting up anonymous ftp area ${ftphome} for SunOS 5.3 
 
     # Ensure that the /usr/bin directory exists 
     if [ ! -d ${ftphome}/usr/bin ]; then 
         mkdir -p ${ftphome}/usr/bin 
     fi 
 
     cp /usr/bin/ls ${ftphome}/usr/bin 
     chmod 111 ${ftphome}/usr/bin/ls 
 
     # Now set the ownership and modes to match the man page 
     chown root ${ftphome}/usr/bin 
     chmod 555 ${ftphome}/usr/bin 
 
     # this may not be the right thing to do 
     # but we need the bin -> usr/bin link 
     if [ -r ${ftphome}/bin ]; then 
         mv -f ${ftphome}/bin ${ftphome}/Obin 
     fi 
     ln -s usr/bin ${ftphome} 
 
     # Ensure that the /usr/lib and /etc directories exist 
     if [ ! -d ${ftphome}/usr/lib ]; then 
         mkdir -p ${ftphome}/usr/lib 
     fi 
     if [ ! -d ${ftphome}/etc ]; then 
         mkdir -p ${ftphome}/etc 
     fi 
 
     #Most of the following are needed for basic operation, except 
     #for libnsl.so, nss_nis.so, libsocket.so, and straddr.so which are 
     #needed to resolve NIS names. 
 
     cp /usr/lib/ld.so /usr/lib/ld.so.1 ${ftphome}/usr/lib 
 
     for lib in libc libdl libintl libw libnsl libsocket \ 
        nss_nis nss_nisplus nss_dns nss_files 
     do 
        cp /usr/lib/${lib}.so.1 ${ftphome}/usr/lib 
        rm -f ${ftphome}/usr/lib/${lib}.so 
        ln -s ./${lib}.so.1 ${ftphome}/usr/lib/${lib}.so 
     done 
 
     cp /usr/lib/straddr.so.2 ${ftphome}/usr/lib 
     rm -f ${ftphome}/usr/lib/straddr.so 
     ln -s ./straddr.so.2 ${ftphome}/usr/lib/straddr.so 
 
     cp /etc/passwd /etc/group /etc/netconfig ${ftphome}/etc 
 
     chmod 555 ${ftphome}/usr/lib/* 
     chmod 444 ${ftphome}/etc/* 
 
     # Now set the ownership and modes 
     chown root ${ftphome}/usr/lib ${ftphome}/etc 
     chmod 555 ${ftphome}/usr/lib ${ftphome}/etc 
 
     # Ensure that the /dev directory exists 
     if [ ! -d ${ftphome}/dev ]; then 
         mkdir -p ${ftphome}/dev 
     fi 
 
     # make device nodes. ticotsord and udp are necessary for 
     # 'ls' to resolve NIS names. 
     prefix="/devices/pseudo/mm@0:" 
 
     for device in zero 
     do 
        line=`ls -l ${prefix}${device} | sed -e 's/,//'` 
        major=`echo $line | awk '{print $5}'` 
        minor=`echo $line | awk '{print $6}'` 
        rm -f ${ftphome}/dev/${device} 
        mknod ${ftphome}/dev/${device} c ${major} ${minor} 
     done 
 
     prefix="/devices/pseudo/clone@0:" 
     for device in tcp udp ticotsord 
     do 
        line=`ls -l ${prefix}${device} | sed -e 's/,//'` 
        major=`echo $line | awk '{print $5}'` 
        minor=`echo $line | awk '{print $6}'` 
        rm -f ${ftphome}/dev/${device} 
        mknod ${ftphome}/dev/${device} c ${major} ${minor} 
     done 
     chmod 666 ${ftphome}/dev/* 
 
     ## Now set the ownership and modes 
     chown root ${ftphome}/dev 
     chmod 555 ${ftphome}/dev 
 
     if [ ! -d ${ftphome}/pub ]; then 
        mkdir -p ${ftphome}/pub 
     fi 
     chown ftp ${ftphome}/pub 
     chmod 777 ${ftphome}/pub 
 
 
2. 利用华盛顿大学的wu-ftpd来建立。这是一个专门用来建立Anonymous FTPD 
的软件。不过你大概得重新编译一边,按照它的说明书来安装。 
 
 
 
-- 
※ 来源:·BBS 水木清华站 bbs.net.tsinghua.edu.cn·[FROM: 166.111.72.98] 

BBS水木清华站∶精华区