无法将任何内容ssh/部署到Ubuntu服务器



我试图登录/部署一些东西到Ubuntu服务器,这是我的Rails应用程序,但今天早上我突然无法登录。

当我运行SSH ssh deployer@IP -p 420并输入密码时,我会收到一条消息,即密码不正确,并且消息Permission denied, please try again.

当我尝试使用Capistrano部署一些代码时,我得到:

connection failed for: IP (Net::SSH::AuthenticationFailed: deployer)

密码也是正确的。

这个问题发生在今天,昨天一切都很顺利。我仔细检查了Capistrano的设置,但一切都设置正确。

如何检查问题?从哪里开始?看起来今天它停止工作了。

编辑:

ssh -v XXX.XXX.XXX.XX
OpenSSH_6.9p1, LibreSSL 2.1.7
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to XXX.XXX.XXX.XX [107.170.160.89] port 22.
debug1: connect to address XXX.XXX.XXX.XX port 22: Connection refused
ssh: connect to host XXX.XXX.XXX.XX port 22: Connection refused

第2版:

ssh adam$ ssh -v XXX.XXX.XXX.XX -p 420
OpenSSH_6.9p1, LibreSSL 2.1.7
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to XXX.XXX.XXX.XX [XXX.XXX.XXX.XX] port 420.
debug1: Connection established.
debug1: identity file /Users/adam/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/adam/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/adam/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/adam/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/adam/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/adam/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/adam/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/adam/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.0p1 Debian-3ubuntu1
debug1: match: OpenSSH_6.0p1 Debian-3ubuntu1 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 107.170.160.89:420 as 'adam'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr umac-64@openssh.com none
debug1: kex: client->server aes128-ctr umac-64@openssh.com none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:yaXBElIwQJJKsNcGAE8hlDPmD26DyzgZ9ruwtbhs6vo
debug1: Host '[XXX.XXX.XXX.XX]:420' is known and matches the RSA host key.
debug1: Found key in /Users/adam/.ssh/known_hosts:3
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,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/adam/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /Users/adam/.ssh/id_dsa
debug1: Trying private key: /Users/adam/.ssh/id_ecdsa
debug1: Trying private key: /Users/adam/.ssh/id_ed25519
debug1: Next authentication method: password
deployer@XXX.XXX.XXX.XX's password:
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.

当我运行ssh -v deployer@XXX.XXX.XXX.XX -p 420

谢谢。

debug1: Roaming not allowed by server

首先,您应该禁用漫游或升级ssh客户端。

debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/adam/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /Users/adam/.ssh/id_dsa
debug1: Trying private key: /Users/adam/.ssh/id_ecdsa
debug1: Trying private key: /Users/adam/.ssh/id_ed25519

上面的一组行显示,您的ssh客户端向服务器提供了密钥id_rsa,但服务器不接受。最后三行指的是ssh查找的默认密钥文件名,但在本例中没有找到。

debug1: Next authentication method: password
deployer@XXX.XXX.XXX.XX's password:
debug1: Authentications that can continue: publickey,password

然后,ssh客户端提示您输入密码并将其提供给服务器,但服务器不接受

无法从客户端跟踪中判断服务器突然拒绝您的密钥和密码的原因。可能至少有六件事会导致这种情况。为了确定答案,您必须进入服务器并查看系统日志中来自sshd的消息。这些文件通常位于/var/log中。

顺便说一下,以下是可能导致这种情况的一些原因:

  • 您尝试登录的帐户已被管理员锁定(或者密码已过期)
  • 您尝试登录的帐户不存在;它已被删除、重命名,或者您拼错了它
  • 有权访问该帐户的人更改了其密码并更改了授权密钥列表
  • IP地址已更改,您没有连接到您认为的计算机
  • 黑客已经进入服务器并进行了许多更改

最新更新