vsftp3 虚拟用户配置

在配置vsftp3时遇到了两个错误,一是PAM无法找到pam_userdb.so,二是运行时拒绝在可写root内使用chroot。解决方法包括指定pam_userdb.so的正确路径,以及在vsftpd.conf中添加allow_writeable_chroot=YES。通过编辑/etc/pam.d/vsftp.vu和/etc/vsftpd.conf文件,以及创建和设置权限的account.db和vusers.txt文件,成功设置了虚拟用户并允许相关写操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

先说两个错误

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值