Detailed explanation of FTP service construction in linux-- 3. Virtual user
operating environment
OS: Redhat 6.5
IP Address: 192.168.10.128
Hostname: zred
Operating System: Win 7
IP address: 192.168.10.10
Confirm that the two hosts are interconnected.
Requirement: add a virtual user to access ftp.
First we restart the service.
Add Virtual Account
Edit a file vuser
[root@localhost vsftpd]# vim /etc/vsftpd/vuser
Put two users in it.
Convert vuser to database file for PAM recognition
[root@localhost vsftpd]# db_load -T -t hash -f vuser vuser.db
And then modify the file permissions, can strengthen security, so as not to be peeped at by others.
Create a user to specify the home directory for vuser/opt/vuser and log in without using shell
[root@localhost vsftpd]# useradd -d /opt/vuser -s /sbin/nologin vuser
Edit pam authentication module to support virtual user login
[root@localhost vsftpd]# vi /etc/pam.d/vsftpd.vu
Add two sentences to it.
auth required pam_userdb.so db=/etc/vsftpd/vuser //a will be lost
account required pam_userdb.so db=/etc/vsftpd/vuser /* The two files vuser is not an ordinary file but the vuser.db database file created just now. */must be omitted here.
Edit the master profile and add permission statements for guest users at the end
guest_enable=YES
guest_username=vuser
pam_service_name=vsftpd.vu
Restart the service and try to log in
We can also specify a separate configuration folder
Insert at the end of the main configuration file:
user_config_dir=/etc/vsftpd/vu_dir /* Separate user configuration folder */
create a profile
mkdir vu_dir
vi /etc/vsftpd/vu_dir/tom /* Create a user profile in the configuration folder */
anon_umask=022 /* Specify permission to upload files */