Centos6.7 installation configuration vsftpd Virtual user
Demo Environment
System: Linux CentOS 6.7 64-bit
Account Number: Root
Environment: No installation VSFTPD
1 , install dependent software
[email protected] ~]# Yum install pam* db4*-y
Install Pam (for Virtual user authentication) and DB4 (db file to generate the user name password for the virtual user).
2 , installation vsftpd
[email protected] ~]# Yum install vsftpd-y
Set VSFTPD boot:
[[Email protected]]# chkconfig vsftpd on
viewing Startup items through Chkconfig–list|grep vsftpd
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/7F/93/wKioL1cjKHHxEVfkAAAKed-s6fk911.png "style=" float: none; "title=" 1.png "alt=" Wkiol1cjkhhxevfkaaaked-s6fk911.png "/>
3. Configure vsftpd.conf
[email protected] vsftpd]# cd/etc/vsftpd/// switch to this directory
[email protected] vsftpd]# vim vsftpd.conf// Change the configuration file
Partial configuration explanation
Anonymous_enable=no// Controls whether anonymous users are allowed to log in, YES to allow anonymous login, no is not allowed. The default value is yes.
Local_enable=yes// controls whether local users are allowed to log in, YES to allow local users to log in, no is not allowed. The default value is yes.
Write_enable=yes// whether to allow login users to have write permission. is the global setting and the default value is yes.
local_umask=022// the Umask value for local Users when new files are added. The default value is 077.
Xferlog_enable=yes// whether to enable upload/download logging. If enabled, the uploaded and downloaded information will be fully recorded in the file defined by Xferlog_file. The preset is on.
Xferlog_file=/etc/vsftpd/vsftpd.log// set the log file name and path, the default value is/var/log/vsftpd.log.
Xferlog_std_format=yes// if enabled, the log file will be written in Xferlog's standard format, as in WU-FTPD. The default value is off.
Connect_from_port_20=yes// Specifies that FTP uses port 20 for data transfer, and the default value is yes.
idle_session_timeout=600//
Listen=yes// set how long to do nothing to the FTP server, disconnect the FTP connection in seconds. The default value is 300.
pam_service_name=vsftpd// set the name used by Pam and the default value is/ETC/PAM.D/VSFTPD.
Userlist_enable=yes// whether to enable the Vsftpd.user_list file.
Tcp_wrappers=yes// sets whether VSFTPD is combined with TCP wrapper for host access control.
The following lines are to be added
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7F/96/wKiom1cjJ6TRplxIAAAUvPwcDrQ230.png "style=" float: none; "title=" 2.png "alt=" Wkiom1cjj6trplxiaaauvpwcdrq230.png "/>
The Add line explanation
PAM_SERVICE_NAME=VSFTPD.V// set the name used by Pam and the default value is/ETC/PAM.D/VSFTPD. Note: To create a vsftpd.v file in/etc/pam.d/
(Here you can set the path according to your preference, usually with the default configuration.) )
Guest_enable=yes// enable the virtual user. The default value is No.
guest_username=ftpsite// This is used to map virtual users. The default value is FTP. (here can be based on their preferences to set up users, generally using the default, if you set up the user will be established)
user_config_dir=/etc/vsftpd/vsftpd_user_conf// Virtual user's profile path, so don't forget to create a new vsftpd_user_conf folder under the/etc/vsftpd/directory. (Here the file name can be set according to their preferences, but the path can not be changed)
4 , configure virtual users
For example, I want to add a user named Jiaao, the FTP client will use the user name (after password settings) for uploading and downloading, in/etc/vsftpd/vsftpd_user_conf a new file called Jiaao. the file name equals the account name inside the Vsftpd_login.txt, otherwise the following setting is invalid
The contents of the file are:
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/7F/94/wKioL1cjKz_B58vqAAAWi6jsY-s426.png "title=" 5.png " alt= "Wkiol1cjkz_b58vqaaawi6jsy-s426.png"/>
The Add line explanation
Local_root=/home/ap/ftpsite/shanghu/jiaao// the virtual user uploads the downloaded root directory (you can set the path according to your preference)
Anon_world_readable_only=no// This anon_world_readable_only parameter means that when he is yes, the other person in the file must have Read permission to allow the download, The only FTP and Read permission is not downloaded, you must have other people also have Read permission to allow the download, this is a security aspect, if no then as long as the FTP user has read access to the file can be downloaded ,
Write_enable=yes// Writable (can be uploaded)
Anon_upload_enable=yes//
Anon_mkdir_write_enable=yes
Anon_other_write_enable=yes
anon_umask=022
Next, create a new text document that records the user name password for all client users (virtual users) in the/etc/vsftpd/directory: Vsftpd_login.txt
The contents are as follows:
Jiaao
123
Odd rows are user names, and even lines are passwords.
Next, generate a DB file for virtual user authentication
Db_load-t-T Hash-f/etc/vsftpd/vsftpd_login.txt/etc/vsftpd/vsftpd_login.db
Then, edit the Authentication file/ETC/PAM.D/VSFTPD.V, (if you do not set PAM_SERVICE_NAME=VSFTPD.V This parameter, then you need to compile the default/etc/pam.d/vsftpd file , and to comment out the original lines inside, and then add two more lines .
Add the following two sentences
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7F/96/wKiom1cjKpiQhR0BAAAJYLi7aCE625.png "title=" 3.png " alt= "Wkiom1cjkpiqhr0baaajyli7ace625.png"/>
Auth Required pam_userdb.so Db=/etc/vsftpd/vsftpd_login
Account Requiredpam_userdb.so Db=/etc/vsftpd/vsftpd_login
5 , set directory permissions on the server
[Email protected] ap]# chown ftpsite-r/home/ap/ftpsite/
[Email protected] ap]# chmod 755–r/home/ap/ftpsite/
Note: The system does not have the user to add the user first
6 , verify that you can log on to the FTP server
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7F/96/wKiom1cjKsjD63FRAAAn1zY6-EA965.png "title=" 4.png " alt= "Wkiom1cjksjd63fraaan1zy6-ea965.png"/>
Login successful.
This article is from the "Jiaao" blog, make sure to keep this source http://jiaao.blog.51cto.com/10894904/1769073
Centos6.7 installation configuration vsftpd Virtual user