一、 先安装软件包
# yum -y install vsftpd
二、 修改/etc/vsftpd/vsftpd.conf
#vim etc/vsftpd/vsftpd.conf
109 listen=NO
关闭独立模式启动默认
三、 过滤vsftpd安装包以xinetd有关的文件
# rpm -ql vsftpd | grep xinetd
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE/vsftpd.xinetd
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE/vsftpd.xinetd.dir
/usr/share/doc/vsftpd-2.0.5/vsftpd.xinetd
#cp /usr/share/doc/vsftpd-2.0.5/vsftpd.xinetd /etc/xinetd.d/vsftpd
四、 编辑 /etc/xinetd.d/vsftpd
# default: off
# description: The vsftpd FTP server serves FTP connections. It uses \
#
normal, unencrypted usernames and passwords for authentication.
service ftp
{
socket_type = stream
wait = no
user = root
server = /usr/sbin/vsftpd
server_args = /etc/vsftpd/vsftpd.conf
nice = 10
disable = no
flags = IPv4
access_times = 9:00-18:30 //限制访问时间
only_from =192.168.1.0/24 //限制访问网段或IP
no_access = 192.168.0. 0/24 //拒绝访问网段IP
}
注意:
only_from no_access
同时出现时拒绝优先
重新启动xinetd服务 service xinetd restart
查看ftp :netstat -an |grep :21
vsftpd 支持TCP Wrappers机制 可以通过 /etc/hosts.allow 和 /etc/hosts.deny 来限制客户端对ftp的访问。
转载于:https://blog.51cto.com/hobbylinux/526030