If enabled, and vsftpd was compiled with tcp_wrappers support, incoming connections will be fed through tcp_wrappers access control. Furthermore, there is a mechanism for per-IP based configuration. If tcp_wrappers sets the VSFTPD_LOAD_CONF environ-ment
variable, then the vsftpd session will try and load the vsftpd configuration file specified in this variable.
Default: NO
大概的意思就是如果启用tcp_wrapper这个功能,就可以实现来自不同的IP的会话加载不同的配置文件。因此也就能够满足我们的要求,配置步骤如下:
软件环境:CentOS5.7 + vsftpd2.0.5
1、编辑/etc/vsftpd/vsftpd.conf,加入: tcp_wrapper=YES
2、编辑/etc/hosts.allow,加入:
vsftpd:192.168.*.*:setenv VSFTPD_LOAD_CONF /etc/vsftpd/local.class
vsftpd:ALL:setenv VSFTPD_LOAD_CONF /etc/vsftpd/internet.class
注意顺序
3、创建并编辑/etc/vsftpd/local.class,加入内容:
anon_max_rate=0 #匿名登录用户
local_max_rate=0 #授权登录用户
设置为0代表不限速
4、创建并编辑/etc/vsftpd/internet.class,加入内容:
anon_max_rate=300000 #匿名用户的速度约300KB/s
local_max_rate=500000 #授权用户的速度约500KB/s
重启vsftpd服务,这样就实现对192.168.0.0这个网段不限速,其余网段限速的效果。
本文介绍了如何在CentOS5.7环境下配置vsftpd FTP服务器,通过启用tcp_wrapper功能,实现公司内网访问时不进行限速,而公司外网访问时对上传下载速度进行限制的方法。

649

被折叠的 条评论
为什么被折叠?



