1

Accidentally changed permission in home directly using command:

sudo chown -R root:root .

Logging into EC2 instance remotely no longer works. Changing users (with root privileges), or to root user does not work.

ssh [email protected] -i /home/.ssh/id_rsa

Remote root login was disabled as suggested by AWS when instance was created.

Any suggestions on how to login? Or is all hope lost?

1

1 Answer 1

7

Amazon doesn't grant you anyway to log into a VM via any virtual KVM or remote host console.

If you are unable to SSH in at all, which sounds like the case, one way you can recover an instance is by mounting the root partition on another host.

To do this you would:

  • Stop the running instance via the console
  • Detach the relevant EBS volume
  • Spin up a new temp VM
  • Attach the EBS volume to be recovered to the instance
  • Mount the EBS volume to a temp path (/mnt?)
  • Fix any filesystem issues (or simply recover the necessary needed data)
  • Terminate temp VM
  • Attach the newly fixed volume to the old instance or a new instance as required.

If the instance needs to stay online while you attempt the recovery, or want to do a practice run through before doing it to the live volume you can use a snapshot of the problem volume. Take a snapshot of the running volume, and restore that to a new volume and follow the steps above with that volume.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .