ubuntu14.04中vsftpd3.0.2本地用户无法登录

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
gydoesit
帖子: 153
注册时间: 2006-10-10 11:01

ubuntu14.04中vsftpd3.0.2本地用户无法登录

#1

帖子 gydoesit » 2015-08-07 20:59

今天搞了个ubuntu14.04 64bit服务器,用apt-get 安装了vsftpd3.0.2,照着前年(其实前几年也是这样做的)自己写的操作记录来,/etc/vsfptd.conf
也只改了三行,就是允许本地用户、本地用户可写、文件掩码,最终的vsftpd.conf是这样的
listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key

但是用本地用户登录,
530 Login incorrect
登录在用户不在/etc/ftpusers,也就是说,没有被禁止登录。而且登录的本地用户都能正常通过shell登录。

上网查了半天,各种说法都有,但都没解决问题。
因为系统是新的,还没装啥软件,应该也不会有其他软件影响。如果启用匿名用户,那么匿名用户是可以登录的,但本地用户还是不能登录。

求指点
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: ubuntu14.04中vsftpd3.0.2本地用户无法登录

#2

帖子 poloshiao » 2015-08-07 23:55

https://help.ubuntu.com/community/vsftp ... ermissions:
... to enable local users login ...
gydoesit
帖子: 153
注册时间: 2006-10-10 11:01

Re: ubuntu14.04中vsftpd3.0.2本地用户无法登录

#3

帖子 gydoesit » 2015-08-08 11:02

2楼发的无用。因为那些设置早就做了。事实上,我删除vsftpd再重装,不做任何设置(本来local_enable=YES),也无法登录
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: ubuntu14.04中vsftpd3.0.2本地用户无法登录

#4

帖子 poloshiao » 2015-08-08 11:22

我删除vsftpd再重装,不做任何设置(本来local_enable=YES)
http://manpages.ubuntu.com/manpages/tru ... onf.5.html
local_enable
Controls whether local logins are permitted or not. If enabled, normal user accounts in /etc/passwd (or wherever your PAM config references) may be used to log in. This must be enable for any non-anonymous login to work, including virtual users.

Default: NO
預設是 NO

更詳細參閱
1. VSFTPD 官網
http://vsftpd.beasts.org/vsftpd_conf.html
VSFTPD.CONF
2. Ubuntu 14.04 Server Guide
https://help.ubuntu.com/14.04/servergui ... erver.html
FTP Server
也无法登录
也許還有別的原因
自己写的操作记录来,/etc/vsfptd.conf
最终的vsftpd.conf是这样的
確認一下 是 vsfptd.conf 還是 vsftpd.conf ?
xferlog_enable=YES
試試 從 Log File 抓錯
http://manpages.ubuntu.com/manpages/tru ... onf.5.html
參閱
xferlog_enable

檢查
/var/log/vsftpd.log
看看有沒有無法登入的原因
gydoesit
帖子: 153
注册时间: 2006-10-10 11:01

Re: ubuntu14.04中vsftpd3.0.2本地用户无法登录

#5

帖子 gydoesit » 2015-08-08 18:57

自己写的操作记录来,/etc/vsfptd.conf
写错了,是/etc/vsftpd.conf,但操作中是对的,不然会打开一个新的空白文件。

我又重装了系统,因为是vps,所以重装飞快,几秒钟?
还是选的ubuntu14.04的64bit版,进入后啥也不敢作,包括连root用户名都没改,就直接搞vsftpd
先肯定是
apt-get update
再接着
apt-get install vsftpd
会有
Unpacking vsftpd (3.0.2-1ubuntu2.14.04.1) ...
这一类的提示,总之装好了,立即查看/etc/vsftpd.conf,内容如下(为免浪费大家眼神,把注释去掉了):

listen=YES
anonymous_enable=NO
local_enable=YES
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key

可以看到,虽然官方vsftpd默认是local_enable=NO,但是ubuntu的包是YES,所以啥也不用改。就应该能登录
于是添加本地用户,
groupadd test
useradd -g test -d /home/test test
passwd test
通过远程登录控制台,test用户一切正常。但是,同样的问题出现了,不能登录ftp,无论本地登录还是远程登录,在输入密码后,
530 Login incorrect
看日志不起任何作用,是这样的:
Sat Aug 8 06:43:26 2015 [pid 1526] CONNECT: Client "127.0.0.1"
Sat Aug 8 06:43:43 2015 [pid 1525] [test] FAIL LOGIN: Client "127.0.0.1"
Sat Aug 8 06:54:36 2015 [pid 1557] CONNECT: Client "118.121.206.52"
Sat Aug 8 06:54:43 2015 [pid 1556] [test] FAIL LOGIN: Client "118.121.206.52"
完全看不出错误原因。
gydoesit
帖子: 153
注册时间: 2006-10-10 11:01

Re: ubuntu14.04中vsftpd3.0.2本地用户无法登录

#6

帖子 gydoesit » 2015-08-08 19:13

搞定。根本不是上面说的这些原因。
应该编辑/etc/pam.d/vsftpd
把最后一行
auth required pam_shells.so
删除,或注释掉
现在本地用户可以登录了

但原理还不明白。请各位大神解释下,这个认证是啥意思?如何使用?
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: ubuntu14.04中vsftpd3.0.2本地用户无法登录

#7

帖子 poloshiao » 2015-08-08 20:07

搞定。
恭喜
根本不是上面说的这些原因。
应该编辑/etc/pam.d/vsftpd
把最后一行
auth required pam_shells.so
删除,或注释掉
但原理还不明白。
看看 是否有關
viewtopic.php?p=3139947#p3139947
(or wherever your PAM config references)
rhinolt
帖子: 83
注册时间: 2017-01-03 19:08
系统: RHEL7

Re: ubuntu14.04中vsftpd3.0.2本地用户无法登录

#8

帖子 rhinolt » 2020-05-29 8:39

碰到同样的问题了,感谢楼主提供的解决方案
回复