简体   繁体   English

SSH 连接到 EC2 实例失败

[英]SSH connection to EC2 instance fails

I'm trying to create the SSH connection to EC2 instance but getting the error message that the keypair file does not exist.我正在尝试创建与 EC2 实例的 SSH 连接,但收到密钥对文件不存在的错误消息。

AWS Management Console confirms that the keypair file exists: AWS 管理控制台确认密钥对文件存在: 在此处输入图像描述

Making connection to EC2 instance is fine but its seems that there aren't any files:连接到 EC2 实例很好,但似乎没有任何文件: 在此处输入图像描述

AWS Management Console confirms that the right command to set permissions is: AWS 管理控制台确认设置权限的正确命令是:

chmod 400 tauno537_aws_keypair.pem

在此处输入图像描述

When trying to execute this, it gives the following error message:尝试执行此操作时,它会给出以下错误消息:

chmod: cannot access ‘tauno537_aws_keypair.pem’: No such file or directory

When trying to create the SSH connection to EC2 instance, it gives the following error message:在尝试创建与 EC2 实例的 SSH 连接时,它会给出以下错误消息:

ssh ec2-user@x.xxx.xxx.xxx -i tauno537_aws_keypair.pem
Warning: Identity file tauno537_aws_keypair.pem not accessible: No such file or directory.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

What I have done wrong?我做错了什么? Is it correct that when...当...时是否正确

  1. Making connection to EC2 instance (PuTTY login), the private key needs to be used?连接EC2实例(PuTTY登录),需要使用私钥吗?
  2. Creating SSH connection, the public key needs to be used?创建SSH连接,需要使用公钥吗?

What's the diference between PuTTY login and SSH connection at all? PuTTY登录和SSH连接有什么区别? Doesn't they both mean that making the connection to the EC2 instance?它们不是都意味着连接到 EC2 实例吗?

Both your errors point to the fact that the private key file is not found in the directory where you're running from/pointing the private key to您的两个错误都表明在您运行/指向私钥的目录中找不到私钥文件

Putty is just a SSH/Telnet client, so ultimately you are using a SSH connection. Putty 只是一个 SSH/Telnet 客户端,所以最终您使用的是 SSH 连接。 When a keypair is created, the private key remains clientside and the public key is uploaded to the server创建密钥对时,私钥保留在客户端,公钥上传到服务器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM