一、安装与配置vsftpd
1,安装vsftpd:
#yum -y install vsftpd xinetd ftp
2,复制配置文件
#cp /usr/share/doc/vsftpd-2.2.2/vsftpd.xinetd  /etc/xinetd.d/vsftpd
3,修改配置文件        
 
复制代码 代码示例:
#cat /etc/vsftpd/vsftpd.conf |grep listen= (默认yes改为no)
listen=NO 
# cat /etc/vsftpd/vsftpd.conf |grep tcp_wrapper (默认yes改为no)
tcp_wrappers=NO
# cat /etc/xinetd.d/vsftpd |grep disable   (默认yes改为no)
disable  = no
4,启动服务
# /etc/init.d/xinetd  restart
5,测试
 
复制代码 代码示例:
# ftp 127.0.0.1
Connected to 127.0.0.1 (127.0.0.1).
220 (vsFTPd 2.2.2)
Name (127.0.0.1:root): xxxx
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
二,扩展操作:
限制客户访问vsftpd的访问时间段(限制客户8:30到11:30可以登录)
方法1:修改配置文件
 
复制代码 代码示例:
# vim /etc/xinetd.d/vsftpd
service ftp
{
        socket_type    = stream
        wait  = no
        user  = root
        server= /usr/sbin/vsftpd
        server_args    = /etc/vsftpd/vsftpd.conf
        nice  = 10
        disable        = no
        access_times   =8:30-11:30   (限制客户8:30到11:30可以登录)
        flags = IPv4
}
# /etc/init.d/xinetd  restart
即可在指定时间段登陆。
方法2:
 
复制代码 代码示例:
iptables -A INPUT -p  tcp -s 192.168.66.0/255.255.255.0 --dport 21 -m time --timestart 8:30 --timestop 11:30 -j ACCEPT
iptables -A OUTPUT -p tcp -d 192.168.66.0/255.255.255.0 --sport 21 -m time --timestart 8:30 --timestop 11:30 -j ACCEPT