proxy代理   soft软件   IT 业界特快   norton 诺顿病毒库   代理列表   search FTP搜索   whois IP地理位置   blog 追求完美  
money理财   life生活   RSS聚合门户   firefox WEB浏览器   免费域名   typeset 假古文   AntiVirus 反病毒   ipcn 站点导航  

« OpenVPN | Main | [ISO] readme.txt of v0.003 (windows01.v0.003.iso) »

February 9, 2004

newftpuser.sh for proftpd

版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本声明。
https://windtear.net/archives/2004/02/09/000418.html http://windtear.net/archives/2004/02/09/000418.html

#!/bin/bash
#
# newftpuser.sh for proftpd
# Add ftp user @proftpd
#         By Zhang Xiuling (windtear@ipcn.org)
#
# ftpasswd --passwd --uid 99 --gid 99 --home /opt/temp --name temp \
# --shell /bin/false --file /usr/local/etc/ftpd.passwd
#

#MKPASSWD="/usr/bin/mkpasswd -l 8 -d 0 -c 8 -C 0 -s 0"
DEFAULTUSER=password
DEFAULTPATH=/home/ftp
DEFAULTUID=99
DEFAULTGID=99

PLAINPASSDIR=/usr/local/etc/_user
ADDUSERCMD=/$proftpd_contrib_dir/ftpasswd

FILENAME=`basename $0`

usage() {
   echo
   echo "Add ftp user @proftpd"
   echo
   echo "usage: $FILENAME [USERNAME] [PATH] [UID] [GID]"
   echo "usage: $FILENAME -u [USERNAME]"
   echo "usage: $FILENAME -U [USERNAME]"
   echo "usage: $FILENAME -h/--help/-v/--version"
   echo
   echo "Example:"
   echo "       $FILENAME windtear /home/ftp 99 99"
   echo "       $FILENAME -u windtear"
   echo
   exit
}
[[ $# = 0 ]] && usage
[[ $1 = "-h" || $1 = "--help" || $1 = "-v" || $1 = "--version" ]] && usage

if [ "$1" == "-u" ] || [ "$1" == "-U" ]; then
   echo "update user passwd:"
   FTPIPCNUSER=${2:-$DEFAULTUSER}
   $ADDUSERCMD --passwd --change-password --name $FTPIPCNUSER \
   --shell /bin/false --file /usr/local/etc/ftpd.passwd
   exit
fi

FTPIPCNUSER=${1:-$DEFAULTUSER}
#FTPIPCNPASS=$($MKPASSWD)
#FTPIPCNPASS=${2:-$FTPIPCNPASS}
DEFAULTPATH=${2:-$DEFAULTPATH}
DEFAULTUID=${3:-$DEFAULTUID}
DEFAULTGID=${4:-$DEFAULTGID}

#echo $FTPIPCNPASS > $PLAINPASSDIR/$FTPIPCNUSER
echo $DEFAULTPATH >>$PLAINPASSDIR/$FTPIPCNUSER
echo $DEFAULTUID":"$DEFAULTGID >>$PLAINPASSDIR/$FTPIPCNUSER

$ADDUSERCMD --passwd --uid $DEFAULTUID --gid $DEFAULTGID --home $DEFAULTPATH \
--name $FTPIPCNUSER --shell /bin/false --file /usr/local/etc/ftpd.passwd
本blog WWW

Posted by windtear at February 9, 2004 3:30 PM

本站使用中的任何问题,请与 windtear @ windtear.net 联系
Copyright© 1999-2014 Windtear. All rights reserved.