1. #yum install vsftp -y
2. #yum install db4-utils -y
3.#cd /etc/vsftpd
4. vi vsftpd.conf
anonymous_enable=NO
local_enable=YES
chroot_local_user=YES
guest_enable=YES
guest_username=apache
listen=YES
listen_port=21
anon_umask=022
dirmessage_enable=YES
ftpd_banner=Welcome to FTP service.
local_umask=022
pam_service_name=vsftpd
user_config_dir=/etc/vsftpd/user_conf.d
vsftpd_log_file=/var/log/vsftpd.log
xferlog_enable=YES
xferlog_std_format=YES
pasv_enable=YES
pasv_min_port=30000
pasv_max_port=30999
pasv_promiscuous=YES
max_per_ip=2
max_clients=500
#anon_max_rate=50000
#local_max_rate=50000
5.# mv /etc/pam.d/vsftpd /etc/pam.d/vsftpd.pam
6. #vi /etc/pam.d/vsftpd
auth required /lib/security/pam_userdb.so db=/etc/vsftpd/login
account required /lib/security/pam_userdb.so db=/etc/vsftpd/login
7. #vi /etc/vsftpd/Makefile (只能tab不能有空格)
POSSIBLE += $(shell test -f login && echo login.db)
all: ${POSSIBLE}
%.db: %
@db_load -T -t hash -f $< $@
clean:
rm -f *.db *~
start:
/usr/local/sbin/vsftpd /etc/vsftpd/vsftpd.conf &
stop:
killall vsftpd
8.#vi /etc/vsftpd/login
第一行帐户名第二行密码
9. #mkdir /etc/vsftpd/user_conf.d
10.#vi /etc/vsftpd/user_conf.d/帐户名
anonymous_enable=NO
dirmessage_enable=YES
guest_enable=YES
guest_username=apache
listen=YES
local_enable=YES
local_root=目录名
local_umask=022
write_enable=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
anon_umask=022
max_per_ip=0
anon_max_rate=0
local_max_rate=0
data_connection_timeout=300
pasv_enable=YES
pasv_min_port=30000
pasv_max_port=30999
9.#make login.db
10.#vi /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -p tcp -m state –state NEW -m tcp –dport 21 -j ACCEPT
11.#service iptables retart
12.#chkconfig vsftpd on
13.配置基本就完成了,
-A RH-Firewall-1-INPUT -p tcp -m multiport –dports 30000,30999 -m state –state NEW -j ACCEPT