Because there is an FTP server in the work, but each build has more trouble. Then wrote a shell script, here to share the script to everyone, if in doubt, please contact qq:403182580
Default Create VSFTP User: DYC
Password: DYC
FTP Data storage directory:/DATA/FTP
#!/bin/bash# This script for the automated installation of VSFTP, using Virtual user authentication login FTP upload download files echo ====================================================== read -p "Please enter FTP User:" ftp_userif [ ' echo ${#ftp_user} ' -eq 0 ]; thenftp_user=dycfiecho ======================================================read -p "Please enter the FTP password: " ftp_passwdif [ ' echo ${#ftp_passwd} ' -eq 0 ];then ftp_passwd=dycfiecho ======================================================read -p "Please enter user data storage directory:" ftp_dataif [ ' echo ${#ftp_data} ' -eq 0 ];then ftp_data=/data/ftpfiecho ================================ ====================== #vsftpd软件yum -y install vsftpd# to generate a virtual user authentication data file yum -y install db4-utilsmv /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf_bak# Configuration vsftpdcat > /etc/ Vsftpd/vsftpd.conf< <eoflisten=yesanonymous_enable=nodirmessage_enable=yesxferlog_enable=yesxferlog_file=/var/log/ Vsftpd.logxferlog_std_format=yeschroot_list_enable=yeschroot_list_file=/etc/vsftpd/chroot_listchroot_local_ User=yesguest_enable=yesguest_username=ftpuser_config_dir=/etc/vsftpd/vsftpd_user_confpam_service_name= vsftpd.vulocal_enable=yeseofcd /etc/vsftpd# Creating user files touch /etc/vsftpd/user.txtecho $ftp _user >> /etc/vsftpd/user.txtecho $ftp _passwd >> /etc/vsftpd/user.txt# to generate a key file for the user password db_ load -t -t hash -f user.txt /etc/vsftpd/vsftpd_login.dbchmod 600 /etc/ vsftpd/vsftpd_login.dbtouch /etc/pam.d/vsftpd.vu# difference system is 32-bit or 64-bit if ls -l /|grep -c lib64;then echo "auth required /lib64/ Security/pam_userdb.so db=/etc/vsftpd/vsftpd_login ">> /etc/pam.d/vsftpd.vu echo "ACCount required /lib64/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login ">> /etc/ pam.d/vsftpd.vuelse echo "auth required /lib/ Security/pam_userdb.so db=/etc/vsftpd/vsftpd_login ">> /etc/pam.d/vsftpd.vu echo "account required /lib/security/pam_userdb.so db=/etc/ Vsftpd/vsftpd_login ">> /etc/pam.d/vsftpd.vufi# restrict virtual users from switching directories Touch /etc/vsftpd/chroot_listecho $FTP _user >>/etc/vsftpd/chroot_list# Configure the virtual user's profile Mkdir -p /etc/vsftpd/vsftpd_user_ confcd /etc/vsftpd/vsftpd_user_confcat > $ftp _user<<eofwrite_enable=yesanon_world_ readable_only=noanon_upload_enable=yesanon_mkdir_write_enable=yesanon_other_write_enable=yeseofecho " local_root= "$ftp _data>> $ftp _user# Create Data Catalog mkdir -p $ftp _datachown -r ftp:root $ftp _datachmod o+rw $ftp _data/etc/init.d/vsftpd restart
This article is from the "OpenVPN Build" blog, please be sure to keep this source http://lovesource.blog.51cto.com/1454821/1574023
Vsftp Installing shell scripts