码迷,mamicode.com
首页 > 其他好文 > 详细

vsftpd脚本自动化运行编写案例

时间:2018-08-08 15:00:45      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:bak   conf   sof   sed   eve   name   ftp   ever   user   

#!/bin/bash USER1=lin USER1P=123 USER2=fan USER2P=456 #close firewalld and selinux setenforce 0 sed -ri ‘s/^(SELINUX=).*/\1disabled/g‘ /etc/sysconfig/selinux systemctl stop firewalld systemctl disable firewalld #install software cd /etc/yum.repos.d/ mv * /tmp/ curl -o 163.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo sed -i ‘s/\$releasever/7/g‘ /etc/yum.repos.d/163.repo yum -y install wget epel-release vsftpd &>/dev/null #touch list of user and passwd cat >> /etc/vsftpd/vu.list <<EOF $USER1 $USER1P $USER2 $USER2P EOF #anzhaung db4 yum -y install db4* &>/dev/null #jiang gang chuang jiang de list shiyong db4 zhuanhuawei myself db_load -T -t hash -f /etc/vsftpd/vu.list /etc/vsftpd/vu.db # shezhi quanxian chmod 600 /etc/vsftpd/vu.* #add user touch ftp useradd -d /var/ftproot -s /sbin/nologin vftp chmod 755 /var/ftproot/ # PAM renzheng cp /etc/pam.d/vsftpd /etc/pam.d/vsftpd.bak cat > /etc/pam.d/vsftpd <<EOF #%PAM-1.0 auth required pam_userdb.so db=/etc/vsftpd/vu account required pam_userdb.so db=/etc/vsftpd/vu EOF #xiu gai vftpd cat >> /etc/vsftpd/vsftpd.conf <<EOF guest_enable=YES guest_username=vftp user_config_dir=/etc/vsftpd/vusers_dir allow_writeable_chroot=YES EOF # touch /etc/vsftpd/vuser_dir if [ ! -d /etc/vsftpd/vusers_dir ];then mkdir /etc/vsftpd/vusers_dir fi #she zhi vusers quanxian cat >> /etc/vsftpd/vusers_dir/$USER1 <<EOF anon_umask=022 anon_upload_enable=YES anon_mkdir_write_enable=YES anon_other_write_enable=YES EOF touch /etc/vsftpd/vusers_dir/$USER2 #start service systemctl start vsftpd &>/dev/null systemctl enable vsftpd &>/dev/null ss -antl

vsftpd脚本自动化运行编写案例

标签:bak   conf   sof   sed   eve   name   ftp   ever   user   

原文地址:http://blog.51cto.com/13858192/2156231

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!