安装vsftpd、创建根目录
yum install -y vsftpd
mkdir -p /data/ftp
1、创建本地用户限制不能登录系统
useradd -d /data/ftp/ -s /sbin/nologin ftpuser
passwd ftpuser
2、修改配置文件,指定相关端口和目录
vim /etc/vsftpd/vsftpd.conf
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen=YES
local_root=/data/ftp/
listen_port=60021
listen_ipv6=NO
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
3、注释auth required pam_shells.so (登录会报530)
vim /etc/pam.d/vsftpd
#%PAM-1.0
session optional pam_keyinit.so force revoke
auth required pam_listfile.so item=user sense=deny file=/etc/vsftpd/ftpusers onerr=succeed
#auth required pam_shells.so
auth include password-auth
account include password-auth
session required pam_loginuid.so
session include password-auth
4、安装ftp客户端连接测试
yum -y install ftp
ftp 172.21.32.3 60021
网友评论