声明:该配置适用于独立启动的vsftpd
下面是一个配置主机访问控制的例子,在本实例中要实现下述的功能:
●拒绝192.168.2.0/24
●对域smartraing.com和192.168.1.0/24内的所有主机不做连接数限制和最大传输速率限制
●对其他主机的访问限制每IP的连接数为1,最大传输速率限制为10KB/S
为实现此功能,可以将主配置文件配置为每IP的连接数为1和最大传输速率限制为10KB/S,再对smartraing.com和192.168.1.0/24的附加配置文件中不做连接限制
具体操作如下
//查看主配置文件中是否有tcp_wrappers=YES的配置
[root@localhost root]# cat /etc/vsftpd/vsftpd.conf |grep tcp_wrappers
tcp_wrappers=YES
//修改vsftpd的主配置文件/etc/vsftpd/vsftpd.conf
[root@localhost root]# cat <> /etc/vsftpd/vsftpd.conf
> local_max_rate=10000
> anon_max_rate=10000
> max_per_ip=1
> !
//编辑/etc/hosts.allow
[root@localhost root]# cat <>/etc/hosts.allow
> vsftpd: smartraing.com 192.168.1.0/24 : setenv VSFTPD_LOAD_CONF /etc/vsftpd/vsftpd_tcp_wrap.conf
> vsftpd: 192.168.2.0/24: DENY
> !
//编辑/etc/vsftpd/vsftpd_tcp_wrap.conf
[root@localhost root]# cat < /etc/vsftpd/vsftpd_tcp_wrap.conf
> local_max_rate=0
> anon_max_rate=0
> max_per_ip=0
> !
//重启vsftpd
[root@localhost root]# service vsftpd restart
关闭 vsftpd: [ 确定
为 vsftpd 启动 vsftpd: [ 确定
为 vsftpd_tcp_wrap 启动 vsftpd: [ 确定
//配置结束
附:
在书写/etc/hosts.allow时,每一个记录都有如下的语法形式:
vsftpd: 主机表 :setenv VSFTPD_LOAD_CONF 配置文件名
阅读(845) | 评论(1) | 转发(0) |