Lost sudo/su on Amazon EC2 instance
- by barrycarter
I have an Amazon EC2 instance. I can login just fine, but neither "su"
nor "sudo" work now (they worked fine previously):
"su" requests a password, but I login using ssh keys, and I don't
think the root user even has a password.
"sudo <anything>" does this:
sudo: /etc/sudoers is owned by uid 222, should be 0
sudo: no valid sudoers sources found, quitting
I probably did "chown ec2-user /etc/sudoers" (or, more likely "chown
-R ec2-user /etc" because I was sick of rsync failing), so this is my
fault.
How do I recover? I stopped the instance and tried the "View/Change
User Data" option on the AWS EC2 console, but this didn't help.
EDIT: I realize I could kill this instance and create a new one, but was hoping to avoid something that extreme.