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 admin@192.168.1.168:~> 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: (?@192.168.1.10) [INFO] New connection from 192.168.1.10
Feb 28 08:46:34 test pure-ftpd: (?@192.168.1.10) [WARNING] Can't login as [admin]: account disabled
Feb 28 08:46:38 test pure-ftpd: (?@192.168.1.10) [INFO] Logout.
Feb 28 08:46:50 test pure-ftpd: (?@192.168.1.10) [INFO] New connection from 192.168.1.10
Feb 28 08:46:51 test pure-ftpd: (?@192.168.1.10) [WARNING] Can't login as [admin]: account disabled
Feb 28 08:46:53 test pure-ftpd: (?@192.168.1.10) [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