[英]AWS_EC2 ssh Permission denied (publickey)
Ugh, so I've read every SO solution and nothing has worked.呃,所以我已经阅读了每个 SO 解决方案,但没有任何效果。
Long story short, apple reformatted my computer and I lost my Private key to ssh into my aws ec2 linux instance.长话短说,苹果重新格式化了我的电脑,但我丢失了通过 ssh 进入我的 aws ec2 linux 实例的私钥。 I generated a new key, changed the permissions to 400 and tried to ssh but I'm getting:我生成了一个新密钥,将权限更改为 400 并尝试 ssh,但我得到:
Permission denied (publickey).
when i use the -v option I'm seeing:当我使用 -v 选项时,我看到:
ssh: Could not resolve hostname [path-to-my-new-pem]: nodename nor servname provided, or not known
any ideas?有任何想法吗?
when you say that you generated a new key, you still need to import the key pair into the EC2 instance, which obviously you cannot since you lost the current private key.当您说您生成了一个新密钥时,您仍然需要将密钥对导入到 EC2 实例中,这显然不能,因为您丢失了当前的私钥。 ok so how to move it from there.好的,那么如何从那里移动它。
You need the key pair to be uploaded into the ~/.ssh/authorized_keys您需要将密钥对上传到 ~/.ssh/authorized_keys
The procedure is explained in amazon doc Connecting to Your Linux Instance if You Lose Your Private Key该过程在 amazon doc Connecting to Your Linux Instance if You Lost Your Private Key 中进行了说明
basically you need to:基本上你需要:
terminate
as you would loose the current data)停止您的当前实例(不要terminate
因为您会丢失当前数据)--> now you have access to all your data, update the authorized_keys
with the new key pair --> 现在你可以访问你的所有数据了,用新的密钥对更新authorized_keys
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.