# Version : 1.0 # Author : 果子 # Date : 2013-12-14 14:34:12 # Description : 只需要三步即可完成安装 # chmod a+x install_vsftpd.sh # ./install_vsftpd install_server 安装相关服务 # ./install_vsftpd add_user 配置用户信息 # ./install_vsftpd start 启动服务 # Usage : 在浏览器或计算机地址中输入:ftp://192.168.0.1 即可访问,192.168.0.1为主机地址。 # More : 后续将增加一些安全性控制和批量创建用户 # # #!/bin/bash #set -x #调试用 allow=YES deny=NO Sname=vsftpd VFconf="/etc/vsftpd/vsftpd.conf" VFstart="/etc/init.d/vsftpd" VUser="/etc/vsftpd/vuser" VUCdirectory="/etc/vsftpd/vuconf" VFpam="/etc/pam.d/vsftpdd" VFDirectory="/var/www/html" DB4=db4 DB4UTILS="db4-utils" DB4DEVEL="db4-devel" sys_tem="/lib64" http=apache #----------主配置文件-------------- main_config() { if [ -d $sys_tem ];then echo "Your system is 64bit" systems=$sys_tem else echo "Your system is 32bit" systems=/lib fi # touch $VFpam sed -i 's/anonymous_enable=YES/anonymous_enable=NO/g' $VFconf sed -i 's/#chown_uploads=YES/chown_uploads=NO/g' $VFconf sed -i 's/#xferlog_file/xferlog_file/g' $VFconf sed -i 's/#async_abor_enable=YES/async_abor_enable=YES/g' $VFconf sed -i 's/#ascii_upload_enable=YES/ascii_upload_enable=YES/g' $VFconf sed -i 's/#ascii_download_enable=YES/ascii_download_enable=YES/g' $VFconf sed -i 's/#chroot_local_user=YES/chroot_local_user=YES/g' $VFconf sed -i 's/pam_service_name=vsftpd/pam_service_name=vsftpdd/g' $VFconf { echo "guest_enable=$allow" echo "guest_username=$http" echo "user_config_dir=$VUCdirectory" echo "virtual_use_local_privs=$allow" } >> $VFconf touch $VFpam { echo "auth sufficient $systems/security/pam_userdb.so db=$VUser" echo "account sufficient $systems/security/pam_userdb.so db=$VUser" } > $VFpam } #------------用户配置----------------------- user_config () { Uname=$1 userhome="local_root=" userworld="anon_world_readable_only=" userupload="anon_upload_enable=" usermkdir="anon_mkdir_write_enable=" userothen="anon_mkdir_write_enable=" userwrite="write_enable=" echo -e "