在CentOS上安装和配置VSFTP(Very Secure FTP Daemon)服务器的步骤如下:
rpm -q vsftpd
如果未安装,使用以下命令进行安装:
yum -y install vsftpd
vi /etc/vsftpd/vsftpd.conf
anonymous_enable=NO
:禁止匿名用户登录。local_enable=YES
:允许本地用户登录。chroot_local_user=YES
:将用户限制在其主目录内。write_enable=YES
:允许FTP用户上传和下载文件。chroot_list_enable=YES
:如果需要,可以创建一个文件(如 /etc/vsftpd/chroot_list
)来限制用户访问的目录。PAM_service_name=vsftpd
:指定PAM认证文件名。guest_enable=YES
:启用虚拟用户功能,guest_username
指定虚拟用户的宿主用户名。useradd -d /home/ftp_user ftp_user
passwd ftp_user
mkdir /home/ftp_user/ftp_storage
chmod 777 /home/ftp_user/ftp_storage
service vsftpd start
chkconfig --level 2345 vsftpd on
setenforce 0
systemctl stop firewalld
systemctl disable firewalld
vi /etc/sysconfig/iptables
# 添加允许FTP端口(21)和被动模式端口(10060-10090)的规则
systemctl restart iptables
systemctl enable iptables
以上步骤提供了在CentOS上安装、配置VSFTP服务的基本流程。根据具体需求,可能还需要进行进一步的定制和优化。