vsftpd安装配置简要

北城余情 提交于 2019-12-03 11:02:37

环境:CentOS8

一、安装vsftpd

1、安装、启动、设置随系统启动

yum install vsftpd -y
systemctl start vsftpd.service
systemctl enable vsftpd.service

2、安装完成后,开放防火墙端口,无需任何配置即可使用系统用户正常登陆。

二、配置vsftpd

1、备份vsftpd.conf

cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.bak

2、显示已生效的配置

cat /etc/vsftpd/vsftpd.conf |grep ^[^#]

3、内容

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
chroot_local_user=YES
listen=NO
listen_ipv6=YES
pam_service_name=vsftpd
userlist_enable=YES
pasv_enable=YES
pasv_min_port=30000
pasv_max_port=31000

4、开启防火墙端口

firewall-cmd --permanent --add-port=30000-31000/tcpfirewall-cmd --reload

5、添加用户并设置密码

useradd ftpuser -s /sbin/nologin
passwd ftpuser

6、设置FTP用户主目录

vim /etc/passwd  //修改对应的用户主目录

7、错误500:500:OOPS:vsftpd:refasing to run with writable root inside chroot()

vsftpd增强了安全检查,如果用户被限定在了其主目录下,则该用户的主目录不能再具有写权限了!去除用户主目录的写权限即可。

chmod a-w /data/ftproot

8、错误530:

vim /etc/pam.d/vsftpd#auth required pam_sheels.so  //注释该行

9、FTP能正常登录,但无法列目录和文件,检查SELinux是否关闭

vim /etc/selinux/config
将enabled修改为disabled

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!