Continue to chapter VSFTPD, introducing the virtual User Configuration of VSFTPD
I. BACKGROUND Requirements
When more than one user needs different permissions, local users, anonymous users can not control the fine, this time may consider the virtual user, for example, the following requirements.
|
Home Directory |
Read |
Write |
Delete |
whether to allow directory switching |
Tom |
/myftp/tom |
√ |
X |
X |
X |
Jerry |
/myftp/jerry |
√ |
√ |
X |
X |
Admin |
/myftp |
√ |
√ |
√ |
√ |
Second, detailed configuration
"A. Setup: [[email protected] ~]# yum-y install vsftpd B. Create profile: [[email protected] ~]# Cp/etc/vsftpd/vsftpd.conf{,.bak} [[email protected] ~]# vim/etc/vsftpd/vsftpd.conf #关闭匿名用户, Local users must be enabled, Otherwise, the virtual user does not function properly anonymous_enable=no local_enable=yes write_enable=yes #设置禁锢用户, which is turned on by default/etc/vsftpd/ch The user in the Root_list file is imprisoned Chroot_list_enable=yes chroot_list_file=/etc/vsftpd/chroot_list #设置虚拟用户相应功能 (The virtual user Local user, Guest_enable=yes guest_username=virtual pam_service_name=vsftpd.pam user_config_dir=/e TC/VSFTPD/VUSER_CONF.D #设置数据连接 (Passive mode) port range pasv_min_port=30000 pasv_max_port=30999 #关闭反向域名解析 for Accelerated Access Reverse_lookup_enable=no C. Create the PAM Authentication file and specify the virtual user's account number, password database location Note: If the 32-bit system pam_userdb.so module is not in the lib64 directory, details can be RPM-QL Pam | grep UserDB learned [[email protected] ~]# vim/etc/pam.d/vsftpd.pam auth required/lib64/security/pam_user Db.soDb=/etc/vsftpd_login account required/lib64/security/pam_userdb.so db=/etc/vsftpd_login d. Create user password database, odd row user name, even line bit password [[email protected] ~]# vim/etc/vsftpd_login Tom 123 Jerry 123 admin 123 [[email protected] ~]# db_load-t hash-t-f/etc/vsftpd_login/etc/vsftpd_login.db E. Create different for each virtual user permissions [[email protected] ~]# mkdir/etc/vsftpd/vuser_conf.d #TOM用户权限设置: [[email protected] ~] # Vim/etc/vsftpd/vuser_conf.d/tom Local_root=/myftp/tom Anon_world_readable_only=yes anon_upload_en Able=no anon_mkdir_write_enable=no Anon_other_write_enable=no [[email protected] ~]# mkdir/myft P/tom [[email protected] ~]# touch/myftp/tom/tom.read #Jerry用户权限配置: [[email protected] ~]# Cp/etc/vsftpd/vuser_conf.d/{tom,jerry} [[email protected] ~]# Vim/etc/vsftpd/vuser_conf.d/jerry Local_root=/myftp/jerry Anon_world_readable_only=yes Anon_upload_enable=yes Anon_mkdir_write_enable=yes Anon_other_write_enable=no [[email protected] ~]# mkdir/myftp/jerry [[email protected] ~]# Touc H/myftp/jerry/jerry.read.write #Admin用户权限配置: [[email protected] ~]# Cp/etc/vsftpd/vuser_conf.d/{jerry , admin} [[email protected] ~]# vim/etc/vsftpd/vuser_conf.d/admin local_root=/myftp/tom anon_wo Rld_readable_only=yes Anon_upload_enable=yes Anon_mkdir_write_enable=yes Anon_other_write_enable=yes [[email protected] ~]# mkdir/myftp/admin [[email protected] ~]# Touch/myftp/admin/admin.read.wri Te.delete.no_chroot #禁锢用户 [[email protected] ~]# vim/etc/vsftpd/chroot_list Tom Jerry #设置目录权限 [[email protected] ~]# chown virtual-r/myftp/#重启服务 [[email protected] ~] #!sys SystemctlRestart VSFTPD
Third, the test effect
Tom User test results:
Jerry User test results:
Admin user Test Results:
Admin user is also imprisoned ...
Implementing file Transfer service in Linux (ii)