目标
匿名用户可访问,有下载文件权限,没上传文件权限(即可读不可写),并且只可以访问指定文件夹
本地用户可访问(需要提供登录用户名和密码),可以上传下载文件(即可读可写)
1.安装vsftpd
yum install vsftpd -y
2.启动vsftpd服务
systemctl start vsftpd
3.设置开机自启动
systemctl enable vsftpd
4.查看系统是否已经监听21端口
netstat -nltp | grep 21
![](https://i-blog.csdnimg.cn/blog_migrate/0908faad702f200a78fa42ec4c88c804.png)
5.关闭selinux服务
setenforce 0
6.关闭防火墙
iptables -F
7.创建测试文件
touch /var/ftp/pub/test.c
8.设置可访问文件夹权限为777(可读可写可执行)
chmod 777 -R /var/ftp/pub
===============windows测试ftp服务==============
一、匿名用户测试:
1.打开文件资源管理器,搜索路径处输入ftp://+ip
ftp://192.168.81.133/
![](https://i-blog.csdnimg.cn/blog_migrate/f92e9d9493b3ab71f414e45f9de9973a.png)
2.把之前创建的文件拖拽到windows,能拖拽成功即可从CentOS通过ftp服务下载资源,即匿名用户有下载权限
![](https://i-blog.csdnimg.cn/blog_migrate/0a7f30bd45f00230ec8c7ddb16055b97.png)
3.把windows下文件拖拽到CentOs,拖拽不成功即不可以通过ftp服务上传资源到CentOs,即匿名用户没有上传权限
![](https://i-blog.csdnimg.cn/blog_migrate/2e83669882a41c32150f9fd4895d3ba5.png)
---------------------------------------------------------------
二、本地用户测试:
1.打开文件资源管理器,搜索路径处输入ftp://+ip
ftp://192.168.81.133/
2.右键,选择登录,本地用户登录到CentOs
![](https://i-blog.csdnimg.cn/blog_migrate/003e8eb8aa7e5049ba694b470b3932f7.png)
3.把CentOs下的文件拖拽到windows,能拖拽成功即可从CentOS通过ftp服务下载资源,即本地用户有下载权限
![](https://i-blog.csdnimg.cn/blog_migrate/816fa07f60abf8de12561875d2631fee.png)
4.把windows下文件拖拽到CentOs,能拖拽成功即可通过ftp服务上传资源到CentOs,即本地用户有上传权限
![](https://i-blog.csdnimg.cn/blog_migrate/400f89c40978b999ebb63e720eb5537d.png)