我无法使用我的电脑通过 ssh 连接到我的服务器,但我可以使用 termius 应用程序通过我的手机连接到我的服务器。我检查过/etc/hosts.allow
和/etc/hosts.deny
我的 iptables,我也搜索过谷歌,似乎没有适合这个问题的答案。我不知道如何解决它,这是ssh -v 183.17.228.80
输出
debug1: Connecting to 183.17.228.80 [183.17.228.80] port 22.
debug1: Connection established.=======================
debug1: permanently_set_uid: 0/0
debug1: SELinux support disabled
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.2
ssh_exchange_identification: read: Connection reset by peer
Run Code Online (Sandbox Code Playgroud)
我可以ping这个服务器,这里是telnet
telnet 183.17.228.29 22
Trying 183.17.228.29...
Connected to 183.17.228.29.
Escape character is '^]'.
Connection closed by foreign host.
Run Code Online (Sandbox Code Playgroud)
小智 38
只需重新启动您想要 ssh 的服务器。它对我有用,以前我遇到过同样的问题。
小智 14
这实际上意味着您的 IP 被服务器列入黑名单。尝试将您的 IP 地址列入白名单以便能够登录。您可以查看 /etc/hosts 列表以查看您的服务器的 IP 地址是否已更改。
小智 7
我解决问题的方法是我去主机并运行了一些命令。
sudo mkdir /var/run/sshd
sudo chmod 755 -R /var/run/sshd
sudo service ssh restart
Run Code Online (Sandbox Code Playgroud)
在那之后,我连接到了机器。
小智 5
看起来服务器上的 ssh 守护进程已挂起。你确定它正在运行吗?当您 telnet 到 ssh 时,您必须看到签名。就像是:
telnet unixhow.com 22
Trying 35.228.26.20...
Connected to unixhow.com.
Escape character is '^]'.
SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.1
Run Code Online (Sandbox Code Playgroud)
我从你的输出中看到的是 ssh 守护进程在服务器端没有响应。我建议通过 IP-KVM(或其他方式)连接到远程计算机并重新启动 sshd。
小智 5
我遇到了同样的问题,但在重新启动 sshd 守护进程后,我可以连接到主机。
sudo systemctl restart sshd && systemctl status sshd
Run Code Online (Sandbox Code Playgroud)
这只是一个临时解决方法,直到您增加 MaxAuthTries 参数。
当您尝试对服务器进行身份验证失败的次数有限制并且客户端上的 ssh 密钥过多(超过 MaxAuthTries 的值)时,就会发生上述错误
您可以尝试增加 MaxAuthTries 的值并重新启动 sshd 守护进程。或者,您可以限制目录中的密钥数量~/.ssh
,并使用子目录和~/.ssh/config
文件来定义每个主机/主机组的密钥
小智 0
归档时间: |
|
查看次数: |
397704 次 |
最近记录: |