Use scripts to add FTP virtual users and give permissions under Linux

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.