Centos 7 installation configuration Vsftp (virtual user login)

Virtual User Features:

1, can only access the FTP server for the services provided, and other resources can not access the system. So, if you want the user has write access to the FTP server inside the station, but other resources are not allowed access to the system, you can use virtual users to improve the security of the system.

2, you can create multiple virtual users set their own password, and sets the appropriate configuration depending on the application, can adapt to a variety of situations.

Virtual User Principle:

Local system user as a host (usually a local user can not log into the system), and then establish the mapping by local system users and virtual users, virtual users log in to FTP services.

Using yum install vsftpd
yum -y install vsftpd

Configuring vsftpd virtual users accessing the service

Create a virtual user password file, the odd behavior of the user name, password behavior even-
vim / etc / vsftpd / vir_user

Centos 7 installation configuration Vsftp (virtual user login)

Generating a virtual user database
[the vsftpd the root @ ~] #yum the install libdb -Y-utils
[the vsftpd the root @ ~] -t -T #db_load /etc/vsftpd/vir_user/etc/vsftpd/vir_user.db the hash -f
[the root @ vsftpd ~] #chmod 700 /etc/vsftpd/vir_user.db

Configuring vsftpd pam verification file:

The auth configuration line account and all are commented out, add the following two lines

[root@vsftpd ~]#vim /etc/pam.d/vsftpd
auth required pam_userdb.so db=/etc/vsftpd/vir_user
account required pam_userdb.so db=/etc/vsftpd/vir_user

Increasing a system user 'virftp', all users are mapped to this virtual file system read and write operations to the user:
mkdir / ftproot
the useradd -d / ftproot -s / sbin / nologin virftp
chown -R & lt virftp: virftp / ftproot

Set vsftpd master configuration file
[root @ vsftpd ~] #vim /etc/vsftpd/vsftpd.conf
Centos 7 installation configuration Vsftp (virtual user login)

Centos 7 installation configuration Vsftp (virtual user login)

Create and configure each virtual user configuration file, the file name is 'virtual user name'

[root@vsftpd ~]#vim /etc/vsftpd/vsftpd_viruser/test1

Centos 7 installation configuration Vsftp (virtual user login)

    创建虚拟用户的根目录,要保证虚拟用户映射的系统用户,对这个根目录有读写权限

[root@vsftpd ~]#mkdir -p /ftproot/admin/
[root@vsftpd ~]#chown -R virftp.virftp /ftproot/admin/

Restart service
systemctl restart vsftpd
set boot from the start
systemctl enable vsftpd
turn off the firewall
systemctl STOP firewalld
setenforce 0
using filezilla Software Testing

Centos 7 installation configuration Vsftp (virtual user login)

To succeed here it

Guess you like

Origin blog.51cto.com/14354119/2426830