先说两个错误
vsftpd: PAM unable to dlopen(/lib/security/pam_userdb.so): /lib/security/pam_userdb.so: cannot open shared object file: No such file or directory
应该是找不到pam_userdb.so. 我们把前面目录删除或你看下pam_userdb.so在那个目录
cat /etc/pam.d/vsftp.vu
----------
auth required pam_userdb.so db=/etc/vsftpd/account
account required pam_userdb.so db=/etc/vsftpd/account
500 OOPS: vsftpd: refusing to run with writable root inside chroot ()
只要在/etc/vsftpd.conf
多加一个设置就可以了
allow_writeable_chroot=YES
/etc/vsftpd.conf文件配置
listen=YES
listen_ipv6=NO
anonymous_enable=NO
local_enable=YES
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
secure_chroot_dir=/var/run/vsftpd/empty
anonymous_enable=NO
local_enable=YES
write_enable=YES
anon_upload_enable=NO
anon_mkdir_write_enable=NO
anon_other_write_enable=NO
chroot_local_user=YES
guest_enable=YES
guest_username=www-data
allow_writeable_chroot=YES
pam_service_name=vsftp.vu
user_config_dir=/etc/vsftpd/vuser_conf
tcp_wrappers=NO
#
# This option specifies the location of the RSA certificate to use for SSL
# encrypted connections.
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=NO
vusers.txt 文件里面 一行用户名一行密码
ftp
123446
admin
123456
./etc/vsftpd 目录结构
├── account.db
├── vuser_conf
│ └── admin
└── vusers.txt
#db_load -T -t hash -f ./vusers.txt /etc/vsftpd/account.db
#chmod 600 /etc/vsftpd/account.db
cat vuser_conf/admin
write_enable=YES
local_root=/home/my/www
anon_upload_enable=YES
anon_umask=0000
file_open_mode=0777
local_umask=0744
anon_other_write_enable=YES
anon_mkdir_write_enable=YES
nopriv_user=www-data