linux网络服务[VSFTP安全文件传输协议]——————匿名用户验证详解、本地用户黑白名单、(部分)用户禁锢家目录、vsftpd被动工作模式配置

1.匿名用户验证实验

1.1 匿名权限控制:

anonymous_enable=YES 启用匿名用户的功能
anon_umask=022 匿名用户所上传文件的权限掩码
anon_root=/var/ftp 匿名用户默认登录目录
anon_upload_enable=YES 允许上传文件
anon_mkdir_write_enable=YES 允许创建目录
anon_other_write_enable=YES 开放其他写入权限(删除、覆盖、重命名)
anon_max_rate=0 限制最大传输速率(0为不限速,单位:byte/秒)

1.2 实验内容

实验准备:

  • 一台vsftpd服务器,关闭火墙和selinux,ip为172.25.5.10/24
  • 一台测试机安装ftp服务,ip为172.25.5.1/24

1)服务器端安装vsftpd:

[root@vsftpd-server ~]# yum install vsftpd -y
Installed:
  vsftpd.x86_64 0:3.0.2-21.el7                                                                                  

Complete!

[root@vsftpd-server ~]# systemctl enable vsftpd
Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.
[root@vsftpd-server ~]# systemctl start vsftpd

2)客户端安装ftp服务:

[root@client ~]# yum install ftp -y
Installed:
  ftp.x86_64 0:0.17-67.el7                                                                                      

Complete!

3)客户端登录服务端vsftpd服务:

[root@client ~]# ftp 172.25.5.10 
Connected to 172.25.5.10 (172.25.5.10).
220 (vsFTPd 3.0.2)
Name (172.25.5.10:root): ftp
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> 

4)查看登录位置:

ftp> ls
227 Entering Passive Mode (172,25,5,10,72,14).
150 Here comes the directory listing.
drwxr-xr-x    2 0        0               6 Jun 23  2016 pub
-rw-r--r--    1 0        0               0 Aug 21 01:22 song.txt
226 Directory send OK.

5)服务端验证,是同一位置:

[root@vsftpd-server ~]# cd /var/ftp/
[root@vsftpd-server ftp]# ls
pub  song.txt

1.2.1 实现上传

1)服务端配置文件,允许上传:

[root@vsftpd-server ~]# vim /etc/vsftpd/vsftpd.conf
# 允许匿名用户上传
anon_upload_enable=YES

2)服务端目录文件系统允许写入:

[root@vsftpd-server ~]# cd /var/ftp/ #进入默认根
[root@vsftpd-server ftp]# ls
pub  song.txt
[root@vsftpd-server ftp]# mkdir upload # 新建一个上传目录,更安全,不回混乱
[root@vsftpd-server ftp]# ll
total 0
drwxr-xr-x 2 root root 6 Jun 23  2016 pub
-rw-r--r-- 1 root root 0 Aug 21 09:22 song.txt
drwxr-xr-x 2 root root 6 Aug 21 10:50 upload
[root@vsftpd-server ftp]# chmod o+w upload/ # 给予其他人写权限
[root@vsftpd-server ftp]# ll
total 0
drwxr-xr-x 2 root root 6 Jun 23  2016 pub
-rw-r--r-- 1 root root 0 Aug 21 09:22 song.txt
drwxr-xrwx 2 root root 6 Aug 21 10:50 upload # 给予成功

3)服务端重启vsftpd服务:

[root@vsftpd-server ftp]# systemctl restart vsftpd

4)客户端测试,查看upload目录是否存在:

[root@client ~]# ftp 172.25.5.10
Connected to 172.25.5.10 (172.25.5.10).
220 (vsFTPd 3.0.2)
Name (172.25.5.10:root): ftp
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
227 Entering Passive Mode (172,25,5,10,215,212).
150 Here comes the directory listing.
drwxr-xr-x    2 0        0               6 Jun 23  2016 pub
-rw-r--r--    1 0        0               0 Aug 21 01:22 song.txt
drwxr-xrwx    2 0        0               6 Aug 21 02:50 upload # 目录已经存在

5)进入上传目录上传文件:

ftp> cd upload # 进入上传目录
250 Directory successfully changed.
ftp> ls 
227 Entering Passive Mode (172,25,5,10,223,149).
150 Here comes the directory listing.
226 Directory send OK.
ftp> put anaconda-ks.cfg  # 上传文件
local: anaconda-ks.cfg remote: anaconda-ks.cfg
227 Entering Passive Mode (<
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值