![无法从任何机器通过 SSH 进入 Ubuntu 服务器](https://linux22.com/image/1205314/%E6%97%A0%E6%B3%95%E4%BB%8E%E4%BB%BB%E4%BD%95%E6%9C%BA%E5%99%A8%E9%80%9A%E8%BF%87%20SSH%20%E8%BF%9B%E5%85%A5%20Ubuntu%20%E6%9C%8D%E5%8A%A1%E5%99%A8.png)
我有一台 Ubuntu 服务器,到目前为止运行良好。我无法通过 SSH 进入服务器并收到以下错误:
Connecting to [email protected]...
OpenSSH_7.8p1, OpenSSL 1.0.2k 26 Jan 2017
debug2: resolve_canonicalize: hostname 10.10.0.6 is address
debug2: ssh_connect_direct
debug1: Connecting to 10.10.0.6 [10.10.0.6] port 22.
debug1: Connection established.
debug1: getpeername failed: No such file or directory
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: identity file /.ssh/id_xmss type -1
debug1: identity file /.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.8
ssh_exchange_identification: Connection closed by remote host
我还尝试登录同一网络上的另一台计算机,并从该计算机通过 ssh 进入 Ubuntu 服务器,但仍然不起作用。您知道可能发生了什么问题以及如何解决吗?
答案1
您可能需要直接登录服务器并生成您的 ssh 密钥:
$ ssh-keygen
这将询问一些问题,以便您可以设置您的密钥。
在您的客户端机器上也执行此操作。
还有更多信息这里。
您可能还需要重新安装 openssh:
$ sudo apt install --reinstall openssh-server openssh-client