建立虚拟用户
需要使用db_load,需要安装的软件包
cd Server ;ls db4*.x86_64.rpm
# cat ftpuser.txt
aaa
aaapass
bbb
bbbpass
ccc
cccpass
test
601
db_load -T -t hash -f /etc/ftpuser.txt /etc/ftpuser.db
chmod 600 /etc/ftpuser.db
vi /etc/pam.d/vsftpd.vu
auth required pam_userdb.so db=/etc/ftpuser
account required pam_userdb.so db=/etc/ftpuser
# cat /etc/vsftpd.conf
listen=YES
anonymous_enable=NO
dirmessage_enable=YES
xferlog_enable=YES
xferlog_file=/var/log/vsftpd.log
xferlog_std_format=YES
chroot_local_user=YES
guest_enable=YES
guest_username=ftp
user_config_dir=/etc/vsftpd_user_conf
pam_service_name=vsftpd.vu
local_enable=YES
secure_chroot_dir=/var/run/vsftpd
mkdir /var/run/vsftpd
# cat test
local_root=/cdma/test
write_enable=YES
local_umask=022
anon_world_readable_only=NO
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=yes
chmod -R o+wx test
需要使用db_load,需要安装的软件包
cd Server ;ls db4*.x86_64.rpm
# cat ftpuser.txt
aaa
aaapass
bbb
bbbpass
ccc
cccpass
test
601
db_load -T -t hash -f /etc/ftpuser.txt /etc/ftpuser.db
chmod 600 /etc/ftpuser.db
vi /etc/pam.d/vsftpd.vu
auth required pam_userdb.so db=/etc/ftpuser
account required pam_userdb.so db=/etc/ftpuser
# cat /etc/vsftpd.conf
listen=YES
anonymous_enable=NO
dirmessage_enable=YES
xferlog_enable=YES
xferlog_file=/var/log/vsftpd.log
xferlog_std_format=YES
chroot_local_user=YES
guest_enable=YES
guest_username=ftp
user_config_dir=/etc/vsftpd_user_conf
pam_service_name=vsftpd.vu
local_enable=YES
secure_chroot_dir=/var/run/vsftpd
mkdir /var/run/vsftpd
# cat test
local_root=/cdma/test
write_enable=YES
local_umask=022
anon_world_readable_only=NO
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=yes
chmod -R o+wx test