EC2 SSH登录失败"不准(公钥)" [英] ec2 ssh login failed "permission denied (publickey)"

查看:143
本文介绍了EC2 SSH登录失败"不准(公钥)"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的搞砸了这一次:我无意中改变了我的xxxxx.pem权限在〜/ .ssh / authorized_keys的所以现在我不能在SSH登录了(权限被拒绝(公钥))。 很显然,我不能访问任何以root身份,因为它是在默认情况下禁止,我该怎么做才能不失去我的实例? 更改我的计算机上的.pem文件的许可,也不会有用,因为其它键访问无法找到(用正确的权限)到〜/ .ssh / authorized_keys中。

I really messed up this time: I accidentally changed my xxxxx.pem permissions in ~/.ssh/authorized_keys so now I can't login in the SSH anymore ("Permission denied (publickey)"). Obviously I can't either access as root because it is forbidden by default, how can I do to not lost my instance? Changing the permission of the .pem file on my computer won't be useful because the other key to access can't be found (with the right permissions) in ~/.ssh/authorized_keys.

我真的不能登录以任何方式,不知道该怎么办。

I can't really login in any way, don't know what to do.

另外创建AMI的形象,纠正错误是没有用的,因为当我从坏的实例创建AMI,将其复制该文件夹的错误许可,所以我不能在新的以及登录。

Also create an AMI's image to correct the mistake is useless because when I create the AMI from the bad-instance, it replicate the wrong permission of the folder, so I can't login in the new one as well.

你知道吗? 谢谢

推荐答案

我搞砸了一个实例一次,我能够通过安装从一个单独的工作实例,其EBS卷来恢复它。请按照下列步骤操作:

I messed up an instance once and I was able to recover it by mounting its EBS volume from a separate working instance. Follow these steps:

  • 从EC2管理控制台,停止你的EC2实例
  • 转至卷屏和分离从实例
  • 有问题的EBS卷
  • 在使用使用默认选项A股的Linux AMI(除非你已经有另一个工作实例)触发一个新的,新的微实例
  • 一旦新的实例运行,连接有问题EBS卷到它
  • 然后挂载
  • From the EC2 Management Console, stop your EC2 instance
  • Go to the Volumes screen and detach the problematic EBS volume from the instance
  • Fire a new, fresh micro instance using a stock Linux AMI with default options (unless you already have another working instance)
  • Once the new instance is running, attach the problematic EBS volume to it
  • Then mount it

在安装的目录,你应该能够在新的实例访问有问题的卷的文件系统,并修复权限问题。然后只需卸载和分离的音量,并重新安装到其他实例。

Once mounted as a directory, you should be able to access the filesystem of the problematic volume from the new instance and fix the permission issue. Then simply unmount and detach the volume and reattach it to the other instance.

这篇关于EC2 SSH登录失败"不准(公钥)"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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