Linux下安装ftp服务

1.在安装前检查是否已安装vsftpd
vsftpd -v

2.安装vsftp(vsftpd 的名字代表"very secure FTP daemon"):
yum install -y vsftpd

3.设置开机启动:
systemctl enable vsftpd

4.启动ftp服务:
systemctl enable vsftpd

5.打开防火墙
firewall-cmd --zone=public --add-port=21/tcp --permanent  //永久添加tcp 21 端口
firewall-cmd --permanent --zone=public --add-service=ftp  //添加ftp服务
firewall-cmd --reload  //重启防火墙

6.添加用户:
useradd -g root -d /home/data -s /sbin/nologin zhc
新建zhc用户 添加到root组
但是不允许用户登录,仅仅可以ftp登录
ftp登录后的默认目录是/home/data

7.设置用户密码
passwd zhc

8.设置权限
chown -R zhc:root /home/data

setsebool -P ftpd_full_access on

如果系统报错:setsebool:  SELinux is disabled.
就: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=permissive
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted

# SETLOCALDEFS= Check local definition changes
SETLOCALDEFS=0

9.修改vsftp配置文件,禁止匿名登录
vi /etc/vsftpd/vsftpd.conf

把anonymous_enable=YES 改为: anonymous_enable=NO

然后重启服务器:
reboot

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值