login到ssh服务器:权限被拒绝,请重试

我正在尝试使用用户名和密码login到我的ssh服务器,但input正确的密码后出现此错误:

Permission denied, please try again. 

可以使用另一台机器上的pubkeylogin,但是我没有禁用常规密码authentication。 我唯一禁用的是rootlogin。

这是我的sshd_config文件:

 #程序包生成的configuration文件
 #详情请参见sshd_config(5)手册页

 #我们听什么端口,IP和协议
港口22
 #使用这些选项来限制sshd将绑定的接口/协议
 #ListenAddress ::
 #ListenAddress 0.0.0.0
议定书2
协议版本2的#HostKeys
 HostKey / etc / ssh / ssh_host_rsa_key
 HostKey / etc / ssh / ssh_host_dsa_key
 HostKey / etc / ssh / ssh_host_ecdsa_key
 #Privilege Separation已打开,以确保安全
 UsePrivilegeSeparation是

 #短命版本1服务器密钥的生存期和大小
 KeyRegenerationInterval 3600
 ServerKeyBits 768

 #logging
 SyslogFacility AUTH
 LogLevel信息

 #authentication:
 LoginGraceTime 120
 PermitRootLogin no
 StrictModes是的

 RSAAuthentication是
 PubkeyAuthentication yes
 #AuthorizedKeysFile%h / .ssh / authorized_keys

 #不要读取用户的〜/ .rhosts和〜/ .shosts文件
 IgnoreRhosts是的
 #为此,您还需要在/ etc / ssh_known_hosts中使用主机密钥

 RhostsRSAAuthentication no
 #协议版本2相似
基于HostbasedAuthentication没有
 #如果您不信任〜/ .ssh / known_hosts以获取RhostsRSAAuthentication,请取消注释
 #IgnoreUserKnownHosts是的

 #要启用空密码,请更改为是(不推荐)
 PermitEmptyPasswords no

 #更改为是以启用质询 - 响应密码(提防问题
 #一些PAM模块和线程)
 ChallengeResponseAuthentication no

 #更改为no以禁用隧道式明文密码
 PasswordAuthentication yes

 #Kerberos选项 
 #KerberosAuthentication no
 #KerberosGetAFSToken no
 #KerberosOrLocalPasswd是的
 #KerberosTicketCleanup是的

 #GSSAPI选项
 #GSSAPIAuthentication no
 #GSSAPICleanupCredentials是的

 X11转发是的
 X11DisplayOffset 10
 PrintMotd no
 PrintLastLog是
 TCPKeepAlive是的
 #使用login号

 #MaxStartups 10:30:60 
 #Banner /etc/issue.net

 #允许客户端传递语言环境variables
 AcceptEnv LANG LC_ *

子系统sftp / usr / lib / openssh / sftp-server

 #将其设置为“yes”以启用PAMauthentication,帐户处理,
 #和会话处理。 如果启用,PAMauthentication将会
 #允许通过ChallengeResponseAuthentication和
 #PasswordAuthentication。 根据您的PAMconfiguration,
 #通过ChallengeResponseAuthentication PAMauthentication可能绕过
 #“PermitRootLogin without-password”的设置。
 #如果你只是想PAM帐户和会话检查运行没有
 #PAMauthentication,然后启用它,但设置PasswordAuthentication
 #和ChallengeResponseAuthentication为“否”。
 UsePAM是的 
 IgnoreUserKnownHosts没有
 PasswordAuthentication yes

我已经添加了最后的两行,最近尝试使它工作。 (我有他们在我的其他VPS,他们在那里工作)

以下是我的用户的〜/ .ssh /目录的列表:

 ls -la /home/skerit/.ssh
共16个
 drwx ------ 2 skerit skerit 4096 2011-06-25 15:11。
 drwxr-xr-x 4 skerit skerit 4096 2011-07-07 21:05
 -rw-r  -  r-- 1 skerit skerit 1882 2011-06-25 15:15 authorized_keys
 -rw-r  -  r-- 1 skerit skerit 884 2011-06-23 22:59 known_hosts 

这是/ usr / sbin / sshd -d的输出:

 debug1:userrauth-request用户skerit服务ssh-connection方法n​​one
 debug1:尝试0失败0
 debug1:PAM:初始化“skerit”
 debug1:PAM:将PAM_RHOST设置为“82.197.70.70”
 debug1:PAM:将PAM_TTY设置为“ssh”
 debug1:userrauth-request用户skerit服务ssh-connection方法publickey
 debug1:尝试1失败0
 debug1:testingpkalg / pkblob是否可以接受
 debug1:检查黑名单文件/usr/share/ssh/blacklist.RSA-2048
 debug1:检查黑名单文件/etc/ssh/blacklist.RSA-2048
 debug1:temporary_use_uid:1000/1000(e = 0/0)
 debug1:尝试公钥文件/home/skerit/.ssh/authorized_keys
 debug1:fd 4清除O_NONBLOCK
 debug1:restore_uid:0/0
 debug1:temporary_use_uid:1000/1000(e = 0/0)
 debug1:尝试公钥文件/home/skerit/.ssh/authorized_keys2
 debug1:无法打开授权密钥'/home/skerit/.ssh/authorized_keys2':没有这样的文件或目录
 debug1:restore_uid:0/0
从82.197.70.70端口57154 ssh2失败公钥为skerit
 debug1:userrauth-request用户skerit服务的ssh-connection方法密码
 debug1:尝试2次失败1
 debug1:PAM:skerit的密码authentication失败:authentication失败
从82.197.70.70端口57154 ssh2失败的skerit密码 

然后我尝试使用相同的用户名和密码login到SSH服务器(本地)的ssh服务器,它工作。 这是在auth.log文件中:

 7月8日12:21:50 vpsnl1 sshd [27298]:debug1:无法打开密钥文件'/ etc / ssh / ssh_host_ecdsa_key':没有这样的文件或目录
 7月8日12:21:50 vpsnl1 sshd [27298]:错误:无法加载主机密钥:/ etc / ssh / ssh_host_ecdsa_key
 7月8日12:22:16 vpsnl1 sshd [27298]:pam_unix(sshd:auth):authentication失败;  logname = uid = 0 euid = 0 tty = ssh ruser = rhost = 82.197.70.70 user =
 skerit
 7月8日12:23:50 vpsnl1 sshd [27439]:在0.0.0.0端口22上侦听的服务器。
 7月8日12:23:50 vpsnl1 sshd [27439]:服务器监听::端口22。
 7月8日12:24:07 vpsnl1 sshd [27458]:错误:无法加载主机密钥:/ etc / ssh / ssh_host_ecdsa_key
 7月8日12:24:14 vpsnl1 sshd [27458]:从127.0.0.1端口接收skerit的密码57667 ssh2
 7月8日12:24:14 vpsnl1 sshd [27458]:pam_unix(sshd:session):通过(uid = 0)为用户skerit打开的会话
 7月8日12:24:25 vpsnl1 sshd [27471]:从127.0.0.1:11收到断开连接:被用户断开连接
 7月8日12:24:25 vpsnl1 sshd [27458]:pam_unix(sshd:session):会话closures用户skerit 

你确定你试图访问的用户帐户是否正确configuration? 如果你以root用户身份login系统,你可以su到用户帐户吗?

 # su - username 

在连接尝试失败后,您在日志中看到了什么? 在许多系统上,sshd会logging到/var/log/secure/var/log/auth.log 。 另外,我注意到你已经启用了PasswordAuthentication但是ChallengeResponseAuthentication禁用了。 如果启用ChallengeResponseAuthentication您是否看到相同的行为?

当你遇到ssh问题时,以下是一些常用的诊断步骤:

  • 在ssh中启用详细诊断:

     ssh -v host.example.com 

    这将导致客户端在协商连接时输出各种诊断消息。 这通常会提供问题的线索。

  • 以debugging模式运行服务器。

    在你的服务器上,停止sshd,然后像下面这样从命令行运行它:

     /usr/sbin/sshd -d 

    这将在stderr上产生详细的debugging日志,这往往会包含有用的信息。

如果这些都不能帮助你弄清楚发生了什么,你会把输出添加到你的问题吗?