今天在服務器上安裝vsftp以便給同志們開放一個ftp私有資源,居然也出了不少問題,這裏作一些簡單的記錄吧。首先設置了chroot限制用戶跨越目錄和其他一些設置,然後寫了下面幾行來寫入僅允許登陸的ftp用戶
#user define
userlist_enable=YES
userlist_deny=NO
userlist_file=/etc/vsftpd.user_allow
userlist_enable=YES
userlist_deny=NO
userlist_file=/etc/vsftpd.user_allow
看上去一切完好如此,沒有發現什麼問題,居然發現登錄的時候失敗。如下所示:
Connected to fsafe.org.
220-Welcome to FSAFE ftp server.
220-If you find any question, please send mail to [email protected].
220
User (fsafe.org:(none)): test
331 Please specify the password.
Password:
530 Login incorrect.
Login failed.
ftp> quit
220-Welcome to FSAFE ftp server.
220-If you find any question, please send mail to [email protected].
220
User (fsafe.org:(none)): test
331 Please specify the password.
Password:
530 Login incorrect.
Login failed.
ftp> quit
驗證了密碼並排除該問題,幾乎頭都大了還是沒有找個這個解決方法,無奈之下開始g搜下了吧,在chinaunix上一個論壇帖子這樣寫到關於此類問題的解釋:
check_shell
Note! This option only has an effect for non-PAM builds of vsftpd. If disabled, vsftpd will not check /etc/shells for a valid user shell for local logins.
Default: YES
Note! This option only has an effect for non-PAM builds of vsftpd. If disabled, vsftpd will not check /etc/shells for a valid user shell for local logins.
Default: YES
也就是說vsftpd在登錄驗證的時候會檢測shell是否在這個列表中,之前對新添加的用戶shell是/bin/false,在/etc/shells中發現沒有添加上,重新ftp登錄成功,其實這個問題應該是linux的版本不同而導致用戶shell不一樣的,看來以後得留意了這方面更新。
###########後記############
vsftp文檔中這樣寫到關於shell的驗證問題,大家就取其一來解決這類問題吧。
check_shell=NO /////注意! 這個選項只對構建時加入 non-PAM 參數的 vsftpd 有效. 如果令其失效, vsftpd 將不會檢查有效用戶的用於本地登錄的 /etc/shells.