FTP实验(6)

安装服务

yum install  vsftpd        #服务端程序

/etc/vsftpd/vsftpd.conf    #主配置文件

服务端ip:192.168.109.134
客户端ip:192.168.109.136

实验一:设置 禁止 匿名用户访问,允许本地用户访问,让本地用户登录后能上传和下载 文件

 ##修改主配置文件/etc/vsftpd/vsftpd.conf

 anonymous_enable=NO    #拒绝匿名用户登录
 local_enable=YES       #允许本地用户登录
 write_enable=YES       #允许本地用户写数据
[root@server7-128 ~]# ftp 192.168.109.134   #连接服务器
Connected to 192.168.109.134 (192.168.109.134).
220 (vsFTPd 3.0.2)
Name (192.168.109.134:root): zhang3       #输入服务器本地账号
331 Please specify the password.
Password:                                 #输入账号密码
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> 

--------------测试结果--------------------
ftp> mkdir 444
257 "/444" created
ftp> ls
227 Entering Passive Mode (192,168,109,134,37,194).
150 Here comes the directory listing.
drwxr-xr-x    2 1001     1002            6 Sep 08 00:22 123
drwxr-xr-x    2 1001     1002            6 Sep 08 00:23 444
-rw-rw-r--    1 1001     1002            0 Jul 24 12:10 file1
226 Directory send OK.

实验二: 对本地登录的 FTP 用户,设置 牢笼,禁止他们随意切换目录

#修改主配置文件参数
    chroot_local_user=YES            #开启本地用户牢笼
    chroot_list_enable=NO            #关闭列表牢笼  
    allow_writeable_chroot=YES     #必写,被牢笼用户可登录,不然那会出错

实验三:新建一个 FTP 用户, ftp2,将他的 登录位置更换到 /data/web/class.com 站点
注意:站点权限也要考虑哦

#创建用户和密码
useradd -d /data/web/class.com -s /sbin/nologin ftp2  #创建yum用户指定家目录为iso下
passwd yum            #设置yum用户密码123123

#服务器端配置文件设置
chroot_local_user=YES            #开启本地用户牢笼
chroot_list_enable=NO            #关闭列表牢笼  
allow_writeable_chroot=YES     #必写,被牢笼用户可登录,不然那会出错

#重启服务
systemctl restart vsftpd
测试结果:
[root@server7-128 ~]# ftp 192.168.109.134   #连接
Connected to 192.168.109.134 (192.168.109.134).
220 (vsFTPd 3.0.2)
Name (192.168.109.134:root): ftp2    #输入账号
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 (192,168,109,134,145,183).
150 Here comes the directory listing.
-rw-r--r--    1 0        0             173 Sep 04 10:28 3000套网站模板免费拥有.url
-rw-r--r--    1 0        0              39 Sep 04 13:26 404.html
drwxr-xr-x    2 0        0               6 Sep 04 10:28 cpts_861_bqn
drwxr-xr-x    2 0        0              86 Sep 04 10:28 css
-rw-r--r--    1 0        0           19251 Sep 04 10:28 events.html
drwxr-xr-x    2 0        0             209 Sep 04 10:28 fonts
-rw-r--r--    1 0        0           15296 Sep 04 10:28 gallery.html

实验4: 给本地用户 设置,速度限制,连接数量限制。

在主配置文件里修改如下参数(没有自行添加)

max_clients=200         #连接中断总个数
max_per_ip=5            #每个ip连接数
local_max_rate=500000   ###传输速度为 50000b 不要设置太小,建议50000以上,否则会导致 ftp 服务进程挂起,传输文件无反应。 
测试结果:
   #打开终端1,2时,能登录,打开第3个终端时提示如下
[root@server7-128 ~]# ftp 192.168.109.134
Connected to 192.168.109.134 (192.168.109.134).
421 There are too many connections from your internet address.
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值