為什麼 vsftpd 不允許我使用虛擬使用者帳號登入?

為什麼 vsftpd 不允許我使用虛擬使用者帳號登入?

我想將 vsftpd 與虛擬使用者和 pam_pwdfile.so 一起使用。我安裝了 vsftpd 並透過 htpasswd 將兩個使用者(ramon 和 Dragon)加入我的檔案 /etc/vsftpd.passwd 中。 /etc/pam.d/vsftpd 設定為使用此檔案。

auth  required        pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed
auth    required pam_pwdfile.so pwdfile /etc/vsftpd.passwd
account required pam_permit.so

@include common-account
@include common-session

使用者「ramon」也可在 中使用/etc/passwd。使用使用者「ramon」登入 ftp 可以按預期工作。但使用「dragon」登入則不然:/結果總是

Login failed: 530 Login incorrect.

由於我可能犯了一個錯誤,因此我嘗試了 中記錄的確切方法/usr/share/doc/vsftpd/examples/VIRTUAL_USERS/README。還是沒有運氣。我可以使用使用者「ramon」登錄,但不能使用使用者「dragon」登入。

有任何想法嗎?

答案1

我有同樣的問題,但是這個線程幫助了。

顯然 vsftpd 在 MD5 雜湊值方面有問題。當我指示 htpasswd 使用 crypt() (-d 選項)時,它突然起作用了:

sudo htpasswd -c -d -b /etc/ftpd.passwd twilight sparkle

答案2

使用下面進行配置。

http://en.gentoo-wiki.com/wiki/Vsftpd#b.29_pam_pwdfile

我已經在我的設置中嘗試過此操作並且它按預期工作。

答案3

將 -d 選項新增至 htpasswd 在我的 Rackspace / Ubuntu 設定中有效:htpasswd -c -d passwd username

答案4

安裝:

apt install vsftpd libpam-pwdfile

使用戶:

useradd -N -s /bin/false -d /home/vsftpd vsftpd

編輯/建立文件:

# /apt/pam.d/vsftpd
auth required pam_pwdfile.so pwdfile /etc/vsftpd/ftpd.passwd
account required pam_permit.so

# /etc/vsftpd.conf
listen=YES
#listen_ipv6=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
xferlog_enable=YES
nopriv_user=vsftpd
chroot_local_user=YES
pam_service_name=vsftpd
utf8_filesystem=YES
hide_ids=YES
user_config_dir=/etc/vsftpd_user_conf
guest_enable=YES
virtual_use_local_privs=YES
pam_service_name=vsftpd
guest_username=vsftpd

# /etc/vsftpd/ftpd.passwd
# user names without passwords
# user name 'upload' has a password.
# if real password is 'MyPassword' then hash created with command:
# openssl passwd MyPassword
programming:
videos:
documents:
furnitures:
sound:
engineer:
games:
programs:
shits:
upload:X7nyBRuyuJVyg

# /etc/vsftpd_user_conf/documents
local_root=/media/nas/Έγγραφα

# /etc/vsftpd_user_conf/engineer
local_root=/media/nas/Μηχανικός
hide_file={/_unsorted_,/personal}

# /etc/vsftpd_user_conf/upload
local_root=/media/nas/downloads/FTP upload
download_enable=NO
write_enable=YES
allow_writeable_chroot=YES

相關內容