CentOS7下安装FTP服务

1、安装vsftp

1.1、安装vsftp

yum -y install vsftpd

1.2、修改配置文件

vi /etc/vsftpd/vsftpd.conf

保证下面3项为YES

anonymous_enable=YES

anon_upload_enable=YES

anon_mkdir_write_enable=YES

 

1.3、设置vsftpd开机启动

systemctl enable vsftpd.service

 

1.4、启动并查看vsftpd服务状态,systemctl启动服务成功不会有任何提示,绿色的active表示服务正在运行

systemctl start vsftpd.service
systemctl status vsftpd.service

 

2、验证ftp是否可以正常访问

2.1、关闭

systemctl stop firewalld.service

  为防止机器重启后防火墙服务重新开启,可将防火墙服务永久关闭。

systemctl disable firewalld.service

2.2、在window上输入ftp://IP地址,可看到ftp下的目录(pub为系统预设的)

 

3、文件读写。

到上面为止,我们发现ftp目录下并不能读写文件,这是由文件夹权限和se引起的。

3.1、设置文件夹权限,将pub文件夹的权限设置为777

chmod 777 -R /var/ftp/pub

3.1、关闭selinux服务

vi /etc/selinux/config

将SELINUX=enforcing改为:SELINUX=disabled

 

3.3、系统重启,让配置生效

shutdown -r now

3.4、上传文件

 

胜象大百科