安装VSFTP
1、服务安装
yum -y install vsftpd
2、服务开机自启
systemctl enable –now vsftpd.service
3、配置文件
/etc/vsftpd/vsftpd.conf: vsftpd 的核心配置文件
/etc/vsftpd/ftpusers :用于指定哪些用户不能访问FTP 服务器。 黑名单
/etc/vsftpd/user_list:指定允许使用vsftpd 的用户列表文件。 白名单
4、创建FTP用户
useradd AOIFTP -d /data/AOIFTP/ -s /sbin/nologin
密码设置:passwd AOIFTP
5、允许用户列表
[root@lz1p-yg-ftp01 data]# cat /etc/vsftpd/user_list # vsftpd userlist # If userlist_deny=NO, only allow users in this file # If userlist_deny=YES (default), never allow users in this file, and # do not even prompt for a password. # Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers # for users that are denied. AOIFTP
6、配置文件修改
[root@lz1p-yg-ftp01 data]# cat /etc/vsftpd/vsftpd.conf anonymous_enable=NO #关闭匿名 local_enable=YES write_enable=YES local_umask=022 chroot_local_user=YES #设置chroot用户家目录 local_root=/data/AOIFTP allow_writeable_chroot=YES dirmessage_enable=YES xferlog_enable=YES connect_from_port_20=YES listen=NO listen_ipv6=YES pam_service_name=vsftpd #启用userlist userlist_enable=NO tcp_wrappers=YES
7、服务重启
systemctl restart vsftpd.service
配置模板
##允许远程访问用户 cat user_list AOIFTP ##设置密码 cat vuser_passwd AOIFTP Luxsan@202z ##禁止默认系统账户开启访问权限 cat ftpusers # Users that are not allowed to login via ftp root adm lp sync shutdown halt mail news uucp operator