Linux

FTP 不允許 /usr/sbin/nologin 使用者

  • December 2, 2016

我想為幾個只使用 ftp 的使用者設置一個 ftp vsftpd。我將 FTP 配置為啟用本地使用者訪問。它工作正常。但是,一旦我將使用者的 shell 編輯為/usr/sbin/nologin,它就無法登錄 FTP 並出現以下錯誤:

Response:   220 Welcome to the Scent Library's File Service.
Command:    USER marketftp
Response:   331 Please specify the password.
Command:    PASS ******
Response:   530 Login incorrect.

這是我所做的:

  • 所有 ftp-only 使用者都將擁有/srv/ftp他們的主目錄。目錄資訊是

/srv/ftp: drwxr-xr-x 3 root slftp 4.0K 2012-02-09 17:20 ftp/

  • 所有 ftp-only 使用者都將在該組中slftp

我用這個條目創建了使用者adduser並最終得到了這個/etc/passwd條目:marketftp:x:1001:1001::/srv/ftp:/usr/sbin/nologin

這在/etc/groupslftp:x:1001:marketftp

  • 配置了以下vsftpd內容,以將使用者限制在自己的家中,但本地使用者除外vsftpd.chroot_list
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list

我的問題在哪裡?由於本地普通使用者可以登錄FTP,所以連接正常。但是為什麼 ftp-only 使用者不能登錄呢?

取自這裡

問)幫助!本地使用者無法登錄。

A) There are various possible problems.

A1) By default, vsftpd disables any logins other than anonymous logins. Put
local_enable=YES in your /etc/vsftpd.conf to allow local users to log in.

A2) vsftpd tries to link with PAM. (Run "ldd vsftpd" and look for libpam to
find out whether this has happened or not). If vsftpd links with PAM, then
you will need to have a PAM file installed for the vsftpd service. There is
a sample one for RedHat systems included in the "RedHat" directory - put it
under /etc/pam.d

A3) If vsftpd didn't link with PAM, then there are various possible issues. Is
the user's shell in /etc/shells? If you have shadowed passwords, does your
system have a "shadow.h" file in the include path?

**A4) If you are not using PAM, then vsftpd will do its own check for a valid
user shell in /etc/shells. You may need to disable this if you use an invalid
shell to disable logins other than FTP logins. Put check_shell=NO in your
/etc/vsftpd.conf.**

你是案例 A4

引用自:https://serverfault.com/questions/358324