[freebsd]虚拟主机shell添加方法[完整]
#!/bin/sh
# make by zjs 2004-11-12 Friday 14:31
#copy right @ 2004
#######
#before you should edit a file maybe it isn't exist
#edit /etc/pw.conf
#***************** blow is the file ****************************
#logfile /var/log/pw.log
#defaultpasswd yes
#home /home/virtual/2005-11
#reuseuids yes
#minuid 2000
#******************
# minuid 2000 // this must repair the real number where you can
# get through use : cat /etc/passwd and find the last uid number
# this id is the begin uid you want to adduser id
#
#
#begin
#ftp filepath
filepath=/home/virtual/2005-11
# this file you should repair it this depend the month
#
#get the two char $1 and $2 which is depend the username and the other is rely t
#
echo "adduser start "
echo $2|pw useradd $1 -s /sbin/nologin -m -h 0
#defaultgroup not set
cd $filepath
#make to filedir
#
mkdir ${1}
mkdir ${1}/public_html
#limit the ftp user 's login father filedir
cp /usr/local/etc/chroot_list /usr/local/etc/chroot_list_back
${1}>> /usr/local/etc/chroot_list
#repair controller
#
chown ${1}:proftpd ${1}/
chown ${1}:proftpd ${1}/public_html
# edit the user's quota
#in this you need add a null user for the example of the quota user
# in this i set the username 100mweb quota set;soft:102400,hard:102400
edquota -p 100mweb ${1}
# end
#
#
#
#virtualhost set
#inifile /usr/local/etc/apache2/httpd.conf
inifile=/usr/local/etc/apache2/httpd.conf
cat <>$inifile
ServerName $1
DocumentRoot $filepath/${1}/public_html
ServerAlias www.$1
RLimitCPU 3|15
RLimitMEM 102400|204800
RLimitNPROC 5|10
EOF
# after all you must restart the apache to let it take effect.
# now the web set except the mysql set is have been done
# thank.
# end time 16:00
# thanks for http://zjs.joo.cn/log
# http://www.linuxaid.com.cn/forum/showdoc.jsp?l=1&i=72306
# and more...
#
# by the way ,after you set all of it you should use this
# chmod 700 addhost.sh
//以前写的,不过有的时候在使用passwd的时候会达不到预设的要求.
再一个对适时的空间大小限制和mysql的开通都没有贴出来..
//等会找找以前的资料,找不到再写写呵呵