无法 SSH 到 aws ec2 实例(t2-micro)

无法 SSH 到 aws ec2 实例(t2-micro)

我正在尝试通过 ssh 连接到我的 ec2 实例

ssh -i key.pem [email protected] -vvv

但是,我收到了一个错误:

Connection to xxx.com closed by remote host.
Connection to xxx.com closed.

这是日志:

debug1: Trying private key: key.pem
debug3: sign_and_send_pubkey: RSA SHA256:xxx
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug1: Authentication succeeded (publickey).
Authenticated to xxx.com ([xx.xx.xx.xxx]:22).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting [email protected]
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: network
debug3: send packet: type 1
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
   #0 client-session (t3 r-1 i0/0 o0/0 fd 4/5 cc -1)

Connection to xxx.com closed by remote host.
Connection to xxx.com closed.
Transferred: sent 2240, received 1572 bytes, in 0.0 seconds
Bytes per second: sent 2975060.5, received 2087854.9
debug1: Exit status -1

你能帮我解决这个问题吗?

答案1

使用了错误的用户。我的实例的正确用户是ubuntu。因此,

ssh -i key.pem [email protected]

让我成功嘘声。不同类型的正确用户列表AMI可以在这里找到:

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/connection-prereqs.html#connection-prereqs-get-info-about-instance

相关内容