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?
You can still access the disk by attaching it to another instance. That way, you can copy across a new key file.
Try this:
/dev/sda1
Attach Volume A to Instance B as some /dev/sdf via console. Though device name provided is /dev/sdf, aws might attach it as /dev/xvdf or /dev/xvdf1. You might have to reboot instance B, if you do not see either /dev/sdf or /dev/xvdf or /dev/xvdf1
Try to mount the volume /dev/xvdf or /dev/xvdf1, access the content, navigate to the ubuntu
user's home directory, store a correct ssh-key