Amazon EC2的权限被拒绝(公钥) [英] Amazon EC2 Permission denied (publickey)

查看:639
本文介绍了Amazon EC2的权限被拒绝(公钥)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这似乎是一个常见的​​问题,但我的具体情况似乎有点不同。

This seems to be a common problem but my specific case seems a little different.

我设置使用命令行工具,一个新的Amazon EC2实例,并通过SSH连接,并做了一些配置工作。

I set up a new Amazon EC2 instance using the command line tools and connected via SSH and did some configuration work.

首先,虽然,我不能ssh登录到该实例,我不得不停止和重新启动实例,然后我可以连接。在重新启动前我刚刚得到了响应。

Initially, though, I couldn't ssh on to the instance, I had to stop and restart the instance, then i could connect. Before restarting I just got the response.

Permission denied (publickey).

这是昨天晚上,今天早上我回到同一个实例,现在我得到的是

That was last night, this morning I go back to the same instance and now all I get is

Permission denied (publickey).

我已经试过没有快乐重启实例。

I've tried rebooting the instance with no joy.

任何人都可以点我朝着正确的方向吗?昨晚的工作同样的命令不再起作用,我从我的MacBook Pro连接。

Can anyone point me in the right direction here? The same command that worked last night no longer works, I'm connecting from my Macbook Pro.

推荐答案

我要回答的情况下,其他人我自己的问题看到了同样的事情......昨天晚上我做了:

I'm going to answer my own question in case anyone else sees the same thing... Last night i had done:

ssh-add ~/.ssh/[keypair name]

然后被连接用:

then been connecting with:

ssh ec2-user@[ec2 instance ip]

今天上午我试图相同,无法连接。但这样做

This morning I tried the same and couldn't connect. But doing

ssh -i ~/.ssh/[keypair name] ec2-user@[ec2 instance ip]

变去的。

使用的ssh-添加上的密钥对再次打动了我。我猜的ssh-添加只我会在发出它在壳体内的作品,当我关闭终端窗口,打开另一个我不再有可用的密钥对没有被明确。

Using ssh-add on the key pair again gets me in. I'm guessing ssh-add only works within the shell I'd issued it in. When I closed the terminal window and opened another I no longer had that keypair available without being explicit.

这篇关于Amazon EC2的权限被拒绝(公钥)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆