FTPd是一款不錯的ftp軟件了,但今天小編設置問題導致Pure-FTPd出現“登錄失敗: 530 Login authentication failed”了,下面我們一起來看問題的解決辦法了.
再次遭遇Pure-FTPd“登錄失敗: 530 Login authentication failed”的問題,這一次的原因竟然是虛擬用戶uid小於pure-ftpd.conf中的MinUID值,現在詳細說明整個查錯過程。
一般情況下,我是使用yum來安裝pure-ftpd,並直接使用PureDB來驗證用戶的登錄,一切是為了方便快捷。這一次也一樣,安裝完後,添加虛擬用戶,綁定到目錄/data/www,但這次給予虛擬用戶指定的用戶和組是apache,其uid和gid是48:
apache:x:48:48:Apache:/data/www:/sbin/nologin
nginx:x:498:498:nginx user:/data/cache/nginx:/sbin/nologin
使用lftp登錄,及提示出錯信息:
lftp [email protected]:~> ls
---- 正在連接到 192.168.1.168 (192.168.1.168) 端口 21
<--- 220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
<--- 220-You are user number 1 of 50 allowed.
<--- 220-Local time is now 08:51. Server port: 21.
<--- 220-This is a private system - No anonymous login
<--- 220 You will be disconnected after 15 minutes of inactivity.
---> FEAT
<--- 211-Extensions supported:
<--- EPRT
<--- IDLE
<--- MDTM
<--- SIZE
<--- REST STREAM
<--- MLST type*;size*;sizd*;modify*;UNIX.mode*;UNIX.uid*;UNIX.gid*;unique*;
<--- MLSD
<--- AUTH TLS
<--- PBSZ
<--- PROT
<--- UTF8
<--- ESTA
<--- PASV
<--- EPSV
<--- SPSV
<--- ESTP
<--- 211 End.
---> AUTH TLS
<--- 500 This security scheme is not implemented
---> OPTS UTF8 ON
<--- 200 OK, UTF-8 enabled
---> OPTS MLST type;size;modify;UNIX.mode;UNIX.uid;UNIX.gid;
<--- 200 MLST OPTS type;size;sizd;modify;UNIX.mode;UNIX.uid;UNIX.gid;unique;
---> USER admin
<--- 331 User admin OK. Password required
---> PASS XXXX
<--- 530 Login authentication failed
---> PWD
ls: 登錄失敗: 530 Login authentication failed
<--- 530 You aren't logged in
---> QUIT
<--- 221-Goodbye. You uploaded 0 and downloaded 0 kbytes.
<--- 221 Logout.
---- 關閉控制連接
而在/var/log/messages中找到的錯誤信息:
Feb 28 08:46:32 test pure-ftpd: ([email protected]) [INFO] New connection from 192.168.1.10
Feb 28 08:46:34 test pure-ftpd: ([email protected]) [WARNING] Can't login as [admin]: account disabled
Feb 28 08:46:38 test pure-ftpd: ([email protected]) [INFO] Logout.
Feb 28 08:46:50 test pure-ftpd: ([email protected]) [INFO] New connection from 192.168.1.10
Feb 28 08:46:51 test pure-ftpd: ([email protected]) [WARNING] Can't login as [admin]: account disabled
Feb 28 08:46:53 test pure-ftpd: ([email protected]) [INFO] Logout.
一直在想,怎麼會出現account disabled的呢,自己都沒有做過禁用帳戶的動作,惟有一行行地查看pure-ftpd.conf的配置內容,當查看到MinUID這行時,突然醒悟過來,請看:
# Minimum UID for an authenticated user to log in.
MinUID 500
一切都明白了,pure-ftpd配置中只允許uid大於等於500的,才可以登錄ftp,因此,解決方法有:
1. 將配置文件的MinUID設置成48,保存重啟pure-ftpd
2. 創建新ftp用戶,uid大於500的,重新分配虛擬用戶uid和gid