First, the FTP configuration should be virtual user login mode
User Password text directory is/etc/vsftpd/vftpuser, the code is as follows:
1#!/bin/Bash2 #3 if[$#-ne2]//Restrict users to enter only a full set of user names and passwords. Odd behavior in user password text user name, even behavior password. 4 Then Echo "Please input a set of username and password" Prompt" Please enter a set of user names and passwords " 5Exit16 fi7 8 forUserinch`sed-N'1~2p'/etc/vsftpd/Vftpuser '//extract the odd line in the file, which is the user name that was created. 9 Do if[ $1==$user]//detect if the user that is about to be created already existsTen Then Echo "user ' $user ' exists" OneExit2 A fi - Done - the Echo-E"$1\n$2">>/etc/vsftpd/vftpuser//Add user name and password to user password text -Db_load-t-T Hash-f/etc/vsftpd/vftpuser/etc/vsftpd/vftpuser.db//Regenerate the authentication db file - - Touch/etc/vsftpd/vsftpd_user_conf/$1// Create user profile + Cat>>/etc/vsftpd/vsftpd_user_conf/$1<<EOF//Add upload and download permissions to the file -anon_world_readable_only=NO +anon_upload_enable=YES Aanon_mkdir_write_enable=YES atanon_other_write_enable=NO -Eof
Run this script
#sh useradd.sh AA bb
Will complete the Add FTP virtual user, the user name is AA, the password is BB.
Use scripts to add FTP virtual users and give permissions under Linux