当SSH不起作用时,如何在Amazon远程实例上更改文件的权限 [英] How to change permission of a file on the amazon remote instance when ssh doesn't work
问题描述
因此,我在远程实例上执行了chmod 777 ec2-user/
,以解决无法写入ec2-user
目录中的文件的问题.但是,由于这更改了.ssh
目录的权限,因此我无法再通过ssh或scp进入我的远程实例.
So i did a chmod 777 ec2-user/
on my remote instance to solve a issue where i couldn't write to a file inside ec2-user
directory. But since this changed the permissions of .ssh
directory i could no longer ssh or scp into my remote instance.
现在我很无能为力.
我该如何解决?我听说没有其他方法,只能将那个volument安装到创建的新实例中,但是我该怎么做呢?我真的对Amazon ws陌生.
How can I fix this? I heard there's no other way rather than mounting that volument into a new instance created, but how do i do this? im really new to amazon ws.
编辑 我试图将其安装到新创建的实例. 一个非常奇怪的问题:实例停止后再次启动,当我单击卷"选项卡时,它使我无法分离该卷.
EDIT I have tried to mount it to a newly created instance. Very strange issue: instance starts back again after stopping it and when i clicked on the Volumes tab, which makes it i can't detach the volume.
推荐答案
停止实例.停止后,分离卷.
Stop the instance. Once it is stopped, detach the volume.
创建一个新实例.将分离的卷与新实例相关联.登录到新实例,并挂载附加的卷.现在,您可以进行所需的任何更改.
Create a new instance. Associate the detached volume with the new instance. Log into the new instance, and mount the attached volume. Now you can make any changes you need.
完成后,请撤消更改:从临时实例中卸载卷,然后取消关联,将其与原始实例重新关联,然后启动原始实例.
When you're done, reverse the changes: unmount the volume from your temporary instance, then disassociate it, re-associate it with the original instance, then start the original instance.
这篇关于当SSH不起作用时,如何在Amazon远程实例上更改文件的权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!