歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Unix知識 >> Unix基礎知識

基於UNIX平台FTP服務器的建立(下)

  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/*
  chown root ${ftphome}/usr/lib ${ftphome}/etc
  chmod 555 ${ftphome}/usr/lib ${ftphome}/etc
  if [ ! -d ${ftphome}/dev ]; then
  mkdir -p ${ftphome}/dev
  fi
  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/*
  chown root ${ftphome}/dev
  chmod 555 ${ftphome}/dev
  #建立一個匿名FTP
  服務
  if [ ! -d ${ftphome}/pub ]; then
  mkdir -p ${ftphome}/pub
  fi
  chown ftp ${ftphome}/pub
  chmod 777 ${ftphome}/pub
  3. 編輯/etc/passwd和/etc/shadow文件
  設置匿名FTP帳號,按下面方法分別對/etc/passwd和/etc/shadow兩個文件中增加如下數據項:
  (1)在/etc/passwd文件中增加
  ftp:x:30000:30000:Anonymous FTP:/home/ftp:/nosuchshell
  (2)在/etc/shadow文件中增加
  ftp:NP:6445::::::
  4. 運行setup程序
  在運行setup程序之前,將該文件設置成執行文件
  #chmod +x setup
  運行setup程序 #setup /home/ftp
  以上步驟就完成了FTP服務器的建立,即可使用FTP服務器,可以用如explorer、netscape navigator等浏覽器對FTP服務器進行訪問,進行下載和上載文件操作,使用非常方便。
Copyright © Linux教程網 All Rights Reserved