CentOS 安装ftp

前端之家收集整理的这篇文章主要介绍了CentOS 安装ftp前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1、检查是否已经安装vsftpd

yum list installed | grep vsftpd

2、安装vsftpd

yum install -y vsftpd

3、检查vsftpd

systemctl status vsftpd.service

分享图片

4、设置ftp服务自动启动

开启自动启动
systemctl enable vsftpd.service
关闭自动启动
systemctl disable vsftpd.service

分享图片

5、启动ftp服务

systemctl start vsftpd.service

分享图片

6、防火墙端口设置

查看zone信息,一般是public
firewall-cmd --get-active-zones
永久打开21端口,--zone=public参数可以省略
firewall-cmd --zone=public --add-port=21/tcp --permanent
添加ftp服务
firewall-cmd --permanent --zone=public --add-service=ftp
重新加载防火墙配置
firewall-cmd --reload

7、添加ftp用户

添加用户xu.dm.ftp,在root组,目录是/home/data,禁止登录,只能ftp
useradd -g root -d /home/data -s /sbin/nologin xu.dm.ftp
设置密码
passwd xu.dm.ftp

8、设置ftp权限

和SElinux相关,一般情况下都是直接把SELinux禁用了
setsebool -P ftpd_full_access on
vi /etc/selinux/config 
# This file controls the state of SELinux on the system. 
# SELINUX= can take one of these three values: 
# enforcing - SELinux security policy is enforced. 
# permissive - SELinux prints warnings instead of enforcing. 
# disabled - SELinux is fully disabled. 
SELINUX=enforcing 
#SELINUX=disabled 
# SELINUXTYPE= type of policy in use. Possible values are: 
# targeted - Only targeted network daemons are protected. 
# strict - Full SELinux protection. 
SELINUXTYPE=targeted 
#SELINUX有「disabled」「permissive」,「enforcing」3种选择。 
模式的设置 :
enforcing:强制模式,只要selinux不允许,就无法执行 
permissive:警告模式,将该事件记录下来,依然允许执行 
disabled:关闭selinux;停用,启用需要重启计算机。 

9、修改vsftp配置文件禁止匿名登录

vi /etc/vsftpd/vsftpd.conf

把:anonymous_enable=YES 改为: anonymous_enable=NO

10、done

 用FileZilla连接,一切OK。

猜你在找的CentOS相关文章