手机站
网通分站
电信主站
密 码:
用户名:
当前位置 : 主页>网站运营>建站经验>列表

wu-ftp管理脚本

来源:互联网 作者:west263.com 时间:2008-04-16
西部数码-全国虚拟主机10强!40余项虚拟主机管理功能,全国领先!双线多线虚拟主机南北访问畅通无阻!免费赠送企业邮局,.CN域名,自助建站480元起,免费试用7天,满意再付款! P4主机租用799元/月.月付免压金!


  echo "Mini Config File ready,now,run ftpclient.sh from client!"

  else

  cp /etc/ftpaccess /etc/ftpaccess.bak

  grep ^class /etc/ftpaccess.bak > /etc/ftpaccess

  echo "Mini Config File ready,now,run ftpclient.sh from client!"

  fi

  elif [ $arg_count -eq 3 ] ; then

  echo -e "class\t$arg_type\t$arg_type\t$arg_addr" > /etc/ftpaccess

  echo "Only $arg_type user from $arg_addr be allowed to use the FTP Server"

  else

  echo -e $"\007Usage:\t$0 mini or $0 mini real/aonoymous address"

  echo -e "\tUse \* or "*" or '*' to replace Any address"

  fi

  }

  limit(){

  class_defined

  if [ $arg_count -ne 3 ] ; then

  echo -e "\007Usage:\t\n$0 limit user_count times"

  echo -e "\tuser_count --- MAX online users at the same time\n"

  echo -e "\ttimes --- during the period of online users limited"

  echo -e "\tMo --- Monday"

  echo -e "\tTu --- Tuesday"

  echo -e "\tWe --- Wednesday"

  echo -e "\tTh --- Thursday"

  echo -e "\tFr --- Friday"

  echo -e "\tSa --- Saturday"

  echo -e "\tSu --- Sunday"

  echo -e "\tWk --- Weekend"

  echo -e "\t0000-1800 --- from 00:00 to 18:00"

  echo -e "\tMoTuWe --- Monday,Tuesday and Wednesday"

  else

  grep -v ^limit /etc/ftpaccess |grep -v ^$ > /etc/ftpaccess.tmp

  mv -f /etc/ftpaccess.tmp /etc/ftpaccess

  echo -e "limit\t$arg_class\t$arg_user_count\t$times\t/home/ftp/.too_many.$arg_class" >> /etc/ftpaccess

  echo -e "\nMore than $arg_user_count ($arg_class class) users online." > /home/ftp/.too_many.$arg_class

  echo -e "\nPlease try a later!" >> /home/ftp/.too_many.$arg_class

  echo " Online $arg_class user limited to $arg_user_count at $times!"

  fi

  }

  loginfails(){

  class_defined

  if [ `grep -c ^loginfails /etc/ftpaccess` -eq 1 ] ; then

  grep -v ^loginfails /etc/ftpaccess > /etc/ftpaccess.tmp

  mv -f /etc/ftpaccess.tmp /etc/ftpaccess

  fi

  if [ $arg_count -ne 2 ] ; then

  echo -e "\007Usage:\t$0 loginfails failed_counts"

  else

  echo -e "loginfails\t$failed_count" >> /etc/ftpaccess

  echo "loginfails count limited to $failed_count !"

  fi

  }

  view(){

  echo -e "\n* * * * * /etc/ftpaccess * * * * *\n "

  cat /etc/ftpaccess

  echo -e "\n* * * * * /etc/ftpusers * * * * *\n "

  cat /etc/ftpusers

  echo -e "\n* * * * * /etc/ftphosts * * * * *\n "

  cat /etc/ftphosts

  # echo -e "\n****/etc/ftpgroups****\n "

  # cat /etc/ftpgroups

  # echo -e "\n****/etc/ftpconversions****\n "

  # cat /etc/ftpconversions

  }

  access(){

  class_defined

  if [ `grep -c ^guestgroup /etc/ftpaccess` -lt 1 ] ; then

  echo -e "\007\nGuestgroup define not found! please run $0 guest username first !"

  exit 1

  fi

  if [ `grep -c ^upload /etc/ftpaccess` -ne 0 ] ; then

  grep -v ^upload /etc/ftpaccess > /etc/ftpaccess.tmp

  mv -f /etc/ftpaccess.tmp /etc/ftpaccess

  fi

  if [ -d /home/ftp/upload ] ;then

  echo "Directory /home/ftp/upload exist !"

  else

  mkdir /home/ftp/upload

  chmod a w /home/ftp/upload

  echo "Directory /home/ftp/upload for user to upload files redeay !"

  fi

  echo -e "\nupload\t/home/ftp/*\t/\tno" >> /etc/ftpaccess

  echo -e "upload\t/home/ftp/*\t/etc\tno" >> /etc/ftpaccess

  echo -e "upload\t/home/ftp/*\t/dev\tno"\n >> /etc/ftpaccess

  echo -e "\nupload\t/home/ftp\t/upload\tyes\troot\tftpadmin\t0600\tnodirs\n" >> /etc/ftpaccess

  echo "You can upload files only to directory /upload !"

文章整理:西部数码--专业提供域名注册虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!