无法使用正确的密码通过远程 SSH 登录

goo*_*ata 8 linux ssh passwords

在昨天 SSH 工作的 cPanel 服务器上,我突然无法使用 SSH 登录。我收到“拒绝访问”。

我检查了密码登录是否已启用,/etc/ssh/sshd_config并且确实如此。我尝试通过 KVM 以 root 身份登录,然后通过 SSH 登录localhost,它可以工作。

我尝试了多个帐户,甚至创建了一个新帐户,但它不起作用,我确定密码是正确的,因为我已多次重置它们,甚至将它们复制粘贴到 Putty 中,更不用说它们通过KVM。

我不知道发生了什么会导致这种情况在一夜之间发生变化。

我还检查sshd_configAllowUser允许您限制访问某个 IP 的指令,但它没有。

还有一点,我只是在手机的 4G 上检查过它,它在那里工作,只是在我的 DSL 上不起作用。

过去,我的 DSL 上的连接对我的服务器来说很慢而且是虚假的。即使在搬到不同国家的不同主机之后。在那些时候,我尝试的所有其他网站都可以正常工作。不确定是否相关。

这是在ssh -vWindows 的 SSH中使用 Git的输出。

OpenSSH_6.6.1, OpenSSL 1.0.1i 6 Aug 2014
debug1: Connecting to <host> [<IP>] port 22.
debug1: Connection established.
debug1: identity file /.ssh/id_rsa type -1
debug1: identity file /.ssh/id_rsa-cert type -1
debug1: identity file /.ssh/id_dsa type -1
debug1: identity file /.ssh/id_dsa-cert type -1
debug1: identity file /.ssh/id_ecdsa type -1
debug1: identity file /.ssh/id_ecdsa-cert type -1
debug1: identity file /.ssh/id_ed25519 type -1
debug1: identity file /.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH_5* compat 0x0c000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<3072<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA <key>
The authenticity of host '<host> (<IP>)' can't be established.
RSA key fingerprint is <key>.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '<host>,<IP>' (RSA) to the list of known hosts.
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: publickey
debug1: Trying private key: /.ssh/id_rsa
debug1: Trying private key: /.ssh/id_dsa
debug1: Trying private key: /.ssh/id_ecdsa
debug1: Trying private key: /.ssh/id_ed25519
debug1: Next authentication method: password
<user>@<host>'s password:
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
Permission denied, please try again.
<user>@<host>'s password:
Run Code Online (Sandbox Code Playgroud)

Gia*_*968 4

\n

过去,我的 DSL 上的连接速度很慢并且与服务器的连接不正常。即使搬到不同国家的不同主机后也是如此。那时我尝试的所有其他网站都工作正常。不确定是否相关。

\n
\n

ssh -v根据您显示 \xe2\x80\x94的调试输出以及上面的评论,我认为与 \xe2\x80\x94 相关,我建议sshd_config您像这样调整服务器上的;请注意,我喜欢使用nano,但请随意使用您喜欢使用的任何文本编辑器。

\n

ssh_config首先,像这样打开文件:

\n
sudo nano /etc/ssh/sshd_config\n
Run Code Online (Sandbox Code Playgroud)\n

应该有一个名为的配置区域GSSAPI options,如下所示:

\n
# GSSAPI options\n#GSSAPIAuthentication no\n#GSSAPICleanupCredentials yes\n
Run Code Online (Sandbox Code Playgroud)\n

更改它以取消注释以下行GSSAPIAuthentication no

\n
# GSSAPI options\nGSSAPIAuthentication no\n#GSSAPICleanupCredentials yes\n
Run Code Online (Sandbox Code Playgroud)\n

最后,保存该文件并重新启动 SSH 服务器守护程序,如下所示。要在基于 RedHat/CentOS 的系统上重新启动 SSH,请执行以下操作:

\n
sudo service sshd restart\n
Run Code Online (Sandbox Code Playgroud)\n

要在基于 Debian/Ubuntu 的系统上重新启动 SSH,请执行以下操作:

\n
sudo service ssh restart\n
Run Code Online (Sandbox Code Playgroud)\n

现在尝试再次登录。我仍然建议ssh -v用于调试目的,但我相信这会解决问题。

\n