代码拉取完成,页面将自动刷新
同步操作将从 Hailiang/lnmp 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/bin/bash
clear
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
. include/common.sh
echo -e "$GREEN
#####################################################################
# LNMP is a bash script for the installation of Nginx + PHP + MySQL.#
# Author Hehl <[email protected]> #
# Blog Http://www.cnblogs.com/ddif #
#####################################################################"
#Define user & password & directory
chk_ftp_user(){
while true;do
echo -e "$GREEN"
read -p "Please input ftp user name:" ftp_user
if [ -z $ftp_user ];then
echo -e "${RED}You input NULL user name${WHITE}"
elif [[ `grep $ngx_user /etc/passwd | wc -l` -lt 1 ]];then
useradd $ngx_user -s /sbin/nologin
else
break
fi
done
}
chk_ftp_passwd(){
while true;do
echo -e "$GREEN"
read -p "Please input ftp password:" ftp_pwd
if [ -z $ftp_pwd ];then
echo -e "${RED}You input NULL password${WHITE}"
elif [[ `echo $ftp_pwd | wc -c` -lt 5 ]];then
echo "You must input 5 character!"
else
break
fi
done
}
chk_ftp_home(){
while true;do
echo -e "$GREEN"
read -p "Please input ftp user directory:(example:$wwwroot_dir) " ftp_user_home
if [ -z $ftp_user_home ];then
echo -e "${RED}You input NULL ftp directory${WHITE}"
elif [ ! -d $ftp_user_home ];then
echo -e "There is no such directory. I will create it."
mkdir -p $ftp_user_home
break
else
break
fi
done
}
while :;do
echo
echo
echo -e "${YELLOW}Please input number(1-6 or q):
\t${YELLOW}1${WHITE}. Create new user
\t${YELLOW}2${WHITE}. Change user dirctory
\t${YELLOW}3${WHITE}. Reset user password
\t${YELLOW}4${WHITE}. Delete user
\t${YELLOW}5${WHITE}. List all user
\t${YELLOW}6${WHITE}. Show user
\t${YELLOW}q${WHITE}. Exit"
read -p "Please input the number: " Number
if [[ $Number =~ ^[1-6,q]$ ]];then
case $Number in
1)
chk_ftp_user
chk_ftp_passwd
chk_ftp_home
echo -e "${ftp_pwd}\n${ftp_pwd}" | $ftp_pw useradd $ftp_user -u $ngx_user -g $ngx_group -d $ftp_user_home -m >/dev/null 2>&1
$ftp_pw mkdb $ftp_pdb -f $ftp_passfile
echo -e "$ftp_user create successful!"
echo -e "$ftp_user directory is ${WARN}$ftp_user_home \n$ftp_user${WHITE} password is ${WARN}${ftp_pwd}${WHITE}"
;;
2)
chk_ftp_user
chk_ftp_home
$ftp_pw usermod $ftp_user -f $ftp_passfile -d $ftp_user_home -m
$ftp_pw mkdb $ftp_pdb -f $ftp_passfile
;;
3)
chk_ftp_user
chk_ftp_passwd
echo -e "${ftp_pwd}\n${ftp_pwd}" | $ftp_pw passwd $ftp_user -f $ftp_passfile -m >/dev/null 2>&1
$ftp_pw mkdb $ftp_pdb -f $ftp_passfile
;;
4)
chk_ftp_user
$ftp_pw userdel $ftp_user -f $ftp_passfile -m
;;
5)
echo -e "User name and directory is:$GREEN"
$ftp_pw list -f ${ftp_passfile}
;;
6)
chk_ftp_user
$ftp_pw show $ftp_user
;;
q)
exit
;;
esac
fi
done
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。