当我 ssh 到在(ami id )中Read from socket failed: Connection reset by peer
运行 AMI 的 EC2 实例时,我得到了这个信息。 ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-20160516.1
us-east-1
ami-13be557e
此 Unix StackExchange 帖子表明服务器可能存在权限问题,并建议检查/var/log/auth.log
我无法 ssh 进入的服务器。
我通过AMI 定位器,因为在撰写本文时,亚马逊的官方 Ubuntu 镜像是 14.04。
$ ssh -vvv -i ~/Downloads/pete.pem [email protected]
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: /etc/ssh_config line 102: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 107.21.86.158 [107.21.86.158] port 22.
debug1: Connection established.
debug3: Incorrect RSA1 identifier
debug3: Could not load "/Users/pete/Downloads/pete.pem" as a RSA1 public key
debug1: identity file /Users/pete/Downloads/pete.pem type -1
debug1: identity file /Users/pete/Downloads/pete.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu1
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu1 pat OpenSSH*
debug2: fd 3 setting O_NONBLOCK
debug3: load_hostkeys: loading entries for host "107.21.86.158" from file "/Users/pete/.ssh/known_hosts"
debug3: load_hostkeys: loaded 0 keys
debug1: SSH2_MSG_KEXINIT sent
Read from socket failed: Connection reset by peer
似乎“不正确的 RSA1 标识符”调试 3 消息是转移注意力的手段。
请注意,我的安全组和网络设置使得我可以看到该机器。 nmap
报告该盒子正在监听端口 22:
$ nmap -sV 107.21.86.158
Starting Nmap 7.00 ( https://nmap.org ) at 2016-06-08 12:06 MDT
Nmap scan report for ec2-107-21-86-158.compute-1.amazonaws.com (107.21.86.158)
Host is up (0.059s latency).
Not shown: 997 filtered ports
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.2p2 Ubuntu 4ubuntu1 (Ubuntu Linux; protocol 2.0)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 5.72 seconds
答案1
原来是我公司的 IT 部门的网络设备配置有误。最后问题解决了,现在 SSH 运行正常。