1、建立Vsftpd虚拟宿主用户
useradd vftp -M -s /sbin/nologin -d /var/ftp/
2、创建虚拟用户的文件
[root@localhost vsftpd]# cat /etc/vsftpd/virtusers test test123456
3、生成虚拟用户口令文件和认证文件
【centos8 vsftpd配置虚拟用户认证】db_load -T -t hash -f /etc/vsftpd/virtusers /etc/vsftpd/virtusers.db chmod 400 vuser_list.db
4、添加认证
[root@localhost vsftpd]# cat /etc/pam.d/vsftpd#%PAM-1.0auth required /lib64/security/pam_userdb.so db=/etc/vsftpd/vuser_listaccount required /lib64/security/pam_userdb.so db=/etc/vsftpd/vuser_list#sessionoptionalpam_keyinit.soforce revoke#authrequired pam_listfile.so item=user sense=deny file=/etc/vsftpd/ftpusers onerr=succeed#authrequired pam_shells.so#authinclude password-auth#accountinclude password-auth#sessionrequiredpam_loginuid.so#sessioninclude password-auth
5、vsftpd.conf配置
mkdir /etc/vsftpd/vconfmkdir /var/ftp/virtualmkdir /var/ftp/virtual/testchown -R vftp.vftp /var/ftp/virtual/[root@localhost vsftpd]# cat vsftpd.confanonymous_enable=NOlocal_enable=YESwrite_enable=YESlocal_umask=022anon_upload_enable=NOanon_mkdir_write_enable=NOdirmessage_enable=YESxferlog_enable=YESconnect_from_port_20=YESchown_uploads=NOxferlog_file=/var/log/vsftpd.logxferlog_std_format=YESasync_abor_enable=YESascii_upload_enable=YESascii_download_enable=YESftpd_banner=Welcome to FTP Serverchroot_local_user=YESls_recurse_enable=NOlisten=YEShide_ids=YESpam_service_name=vsftpduserlist_enable=NOguest_enable=YESguest_username=vftpvirtual_use_local_privs=YESuser_config_dir=/etc/vsftpd/vconf
6、配置虚拟用户配置
[root@localhost vsftpd]# cat /etc/vsftpd/vconf/test local_root=/var/ftp/virtual/testanonymous_enable=NOwrite_enable=YESlocal_umask=022anon_upload_enable=NOanon_mkdir_write_enable=NOidle_session_timeout=600data_connection_timeout=120max_clients=10max_per_ip=5local_max_rate=50000allow_writeable_chroot=YES
7、重启服务|测试
[root@localhost vsftpd]# systemctl restart vsftpd[root@localhost vsftpd]# ftpftp> open 127.0.0.1Connected to 127.0.0.1 (127.0.0.1).220 Welcome to FTP ServerName (127.0.0.1:root): test331 Please specify the password.Password:230 Login successful.Remote system type is UNIX.Using binary mode to transfer files.ftp> ls227 Entering Passive Mode (127,0,0,1,65,5).150 Here comes the directory listing.226 Directory send OK.ftp> dir227 Entering Passive Mode (127,0,0,1,181,149).150 Here comes the directory listing.226 Directory send OK.ftp>
推荐阅读
- Apollo配置中心源码编译及搭建
- 如何使用 Squid 配置 SSH 代理服务器
- Python安装库太慢?配置好这个速度飞起
- SpringBoot常用属性配置
- 配置RHEL8本地yum源及DNF简介
- Bash技巧:介绍一个可以增删改查键值对格式配置文件的Shell脚本
- H3C的INode客户端配置,L2TP配置使用客户端登入。你会了吗?
- 后台服务工具maven:maven安装配置
- 配置sysctl.conf文件来优化系统
- 关于 Spring 注解容器配置的那些事,掌握这几点,不再难