因此,我们团队中的开发人员似乎删除了我们的.ssh/authorized_keys App-Production.pem密钥的.ssh/authorized_keys ,因此默认的AWS Key Pair不再有效,从而破坏了我们的部署管道。
在哪里可以找到要添加回authorized_keys公钥? 是否可以在不必启动新实例的情况下执行此操作?
So, it seems a developer on our team deleted the public key for our App-Production.pem key in our .ssh/authorized_keys, so the default AWS Key Pair no longer works, breaking our deployment pipeline.
Where can I find the public key to add back to authorized_keys? Is it possible to do this without having to boot a fresh instance?
最满意答案
如果您有私钥,则可以检索公钥。
如果您使用的是Linux,请使用以下命令:
ssh-keygen -y然后在提示时提供私钥文件的路径。 之后,您将获得一个公钥。 保存。
然后使用以下步骤重新获得对此实例的访问权限。
停止你的实例 分离根卷 将卷附加到另一个实例作为数据卷 使用公钥修改authorized_keys文件 分离数据卷 将卷重新附加到受影响的实例有关更多信息,请参阅此文档 。
If you have the private key, you can retrieve the public key.
If you are using Linux, use following command,
ssh-keygen -yThen provide your path to private key file when prompted. After that you will be given a public key. Save it.
Then use following steps to regain access to this instance.
Stop your instance Detach root volume Attach volume to another instance as a data volume Modify the authorized_keys file with the public key Detach the data volume Re attach the volume to the affected instanceFor more information follow this doc.
更多推荐
发布评论