作用:安装vsftpd服务
实现:yum在线安装,要求访问互联网, 创建默认账户vsftp(vsftp),访问目录默认为家目录(/home/vsftp)
演示:
代码专区:
#/bin/bash # LY # ------------------ # Copyright 2016.04.16 LingYi ([email protected]) QQ:1519952564 # "install vsftpd service" if rpm -q vsftpd &>/dev/null; then echo -e "\033[32mYou have installed vsftpd !\033[0m" else echo -e "\033[32mInstall now ...\033[0m" yum install -y vsftpd if [[ $? -ne 0 ]]; then echo -e "\033[31mInstall faild, do it by yourself !\033[0m" exit 1 fi fi echo -e "\033[32mConfiging vsftp ...\033[0m" if [[ -f /etc/vsftpd/vsftpd.conf ]]; then cd /etc/vsftpd/ else echo -e "\033[31Configure file Error !\033[0m" exit 1 fi sed -i ‘s/anonymous_enable=YES/anonymous_enable=NO/‘ vsftpd.conf sed -i ‘s/#ascii_upload_enable=YES/ascii_upload_enable=YES/‘ vsftpd.conf sed -i ‘s/#ascii_download_enable=YES/ascii_download_enable=YES/‘ vsftpd.conf sed -i ‘s/#chroot_list_enable=YES/chroot_list_enable=YES/‘ vsftpd.conf sed -i ‘s/#chroot_list_file=/chroot_list_file=/‘ vsftpd.conf echo "userlist_deny"=NO >>vsftpd.conf setenforce 0 #echo "setenforce 0" >>/etc/rc.d/rc.local if useradd -s /sbin/nologin vsftp; then echo ‘vsftp‘ | passwd --stdin vsftp fi echo "vsftp" >>user_list echo "vsftp" >chroot_list chkconfig --level 35 vsftpd on service vsftpd restart echo -e ‘\033[32mNow you can login with user "vsftp" and password is "vsftp"\033[0m‘ cd - >/dev/null
附件下载代码
时间: 2024-10-04 02:31:09