ftp服务的部署

1.部署ftp服务 (在server里)

实验:

getenforce      #查看selinux的状态

vim /etc/sysconfig/selinux #编辑文件,将状态更改为disabled

###########

SELINUX=disabled


reboot      #必须要重启

 

getenforce                #查看状态是否更改成功

yum install lftp          #安装lftp  (这样才能使用lftp命令)

##如果出现报错,说明yum源出现问题,此时需要重新配置server的yum源

yum install vsftpd -y   #安装ftp服务


 



systemctl start vsftpd    #开启ftp服务

systemctl enable vsftpd #开机自动开启ftp服务

*******************

ln -s '/usr/lib/systemd/system/vsftpd.service' '/etc/systemd/system/multi-user.target.wants/vsftpd.service'  

##报错,可以想到可能为火墙不允许


netstat -antlupe | grep vsftpd   #查看端口是否开启

************

tcp6       0      0 :::21                   :::*                    LISTEN      0          38048      1805/vsftpd

##开着的,所以肯定是火墙不允许  

firewall-cmd --list-all #查看火墙允许的启用的服务

注意:此时火墙必须开启,才能查看到

****************

public (default, active)

  interfaces: eth0

  sources:

  services: dhcpv6-client ssh  ##只允许ssh,未启用ftp

  ports:

  masquerade: no

  forward-ports:

  icmp-blocks:

  rich rules:



 

firewall-cmd --permanent --add-service=ftp  #火墙启用ftp服务

firewall-cmd --reload   #重新加载

firewall-cmd --list-all   #检测火墙启用ftp服务是否添加成功

***************

public (default, active)

  interfaces: eth0

  sources:

  services: dhcpv6-client ftp ssh ##启用ftp成功

  ports:

  masquerade: no

  forward-ports:

  icmp-blocks:

  rich rules:



 

cd /var/ftp/   #默认ftp的文件都在/var内

ls

touch westosfile

ls

测试:

lftp 172.25.254.230  #(可以连接)

ls     #可查看到刚建立的文件

quit #退出(断开连接)


1)匿名用户家目录修改

实验:

mkdir /ftpdir/westosdir -p  

vim /etc/vsftpd/vsftpd.conf

##########

添加 anon_root=/ftpdir  #/ftpdir为 /目录名称

systemctl restart vsftpd  #重启ftp服务

测试:

修改之前

lftp 172.25.254.230

ls

************

drwxr-xr-x    2 0        0       6 Mar 07  2014 pub

-rw-r--r--    1 0        0       0 May 07 14:42 westosfile


 修改之后

lftp 172.25.254.230

ls

**************

drwxr-xr-x    2 0        0       6 May 07 14:55 westosdir

 

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值