且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

linux shell vsftpd 匿名用户

更新时间:2022-09-28 10:11:31

#!/bin/bash

###this script is install vsftpd####
yum -y remove vsftpd
yum clean all
yum -y install vsftpd
CONF=/etc/vsftpd/vsftpd.conf
echo "####write a file path####"
read -p "please write a filename,you best Combined with path:" dir
#####dir is a variable####
if [ -d "$dir" ];then
    rm -rf $dir
 else
      mkdir $dir
 fi
mkdir -p $dir/iso
chmod 755 $dir
  chmod 777 $dir/iso
 echo "#####vsftpd install#####"
 echo "#######/etc/vsftpd/vsftpd.conf#####"
 sed -i 's/#anon_upload_enable=YES/anon_upload_enable=YES/g' $CONF
 sed -i 's/#anon_mkdir_write_enable=YES/anon_mkdir_write_enable=YES/g' $CONF
 sed -i 's/userlist_enable=YES/userlist_enable=NO/g' $CONF
  #sed -i  '/\<userlist_enable\>/s/YES/NO/g' $CONF  ##this command same as before###
  cat >> $CONF << EOF
  anon_umask=022
  anon_root=$dir
  EOF
  ##sed -i '/tcp_wrappers/a anon_umask=022' $CONF
  ##sed -i "/tcp_wrappers/a anon_root=$dir" $CONF   ###this command same as cat---EOF###
  echo "########start server######"
 service vsftpd restart
  chkconfig --add vsftpd
 chkconfig --level 35 vsftpd  on
  iptables -F
  setenforce 0
 echo "##############it is ok##########"
 
 
 
 
copy到linux新建的文件里面,给权限然后直接执行,这个必须搭建了yum仓库









本文转自 jie783213507 51CTO博客,原文链接:http://blog.51cto.com/litaotao/1186927,如需转载请自行联系原作者