amazon-web-servicesubuntuamazon-ec2sshauthorized-keys

Amazon AWS EC2 Deleted Key Locked out of Root


I am running an Ubuntu instance on Amazon AWS EC2. I have a root user named ubuntu. I also have another user named ellis. My ubuntu user is the administrative user that has the control of all other users and creating files and directories in the root.

When I was copying the .ssh/authorized_keys from /home/ubuntu/.ssh/authorized_keys to /home/ellis/.ssh I must have accidentally deleted the directory .ssh that was within ubuntu. Now, I am not able to login to my instance as ubuntu, only as ellis. I tried changing permissions within ellis to gain access to ubuntu with no luck.

I used FileZilla as ellis and was able to see the directories and files within ubuntu, that is why I know that .ssh was removed from ubuntu.

I need to be able to access ubuntu. I have tried copying my ssh directory from ellis to ubuntu, but with the permissions that are set up, nothing administrative can be done from other users. Any way to fix this?


Solution

  • You can still access the disk by attaching it to another instance. That way, you can copy across a new key file.

    Try this: