码迷,mamicode.com
首页 > 其他好文 > 详细

CentOS 安装ftp

时间:2019-01-04 00:17:04      阅读:221      评论:0      收藏:0      [点我收藏+]

标签:warning   ima   sel   src   zone   mon   protect   enforce   查看   

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 安装ftp

标签:warning   ima   sel   src   zone   mon   protect   enforce   查看   

原文地址:https://www.cnblogs.com/asker009/p/10217609.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!