0

I'm on an amazon ec2 instance. I ran a script that inadvertently changed the owner of the /etc/sudoers files. Now I can not longer run any commands with sudo. Root does not have a password so I can't log in with that.

I followed the instructions at https://aws.amazon.com/premiumsupport/knowledge-center/ec2-sudo-commands/ which have you upload a bash script that I assume runs upon reboot. However, after rebooting the machine, the permissions on the /etc/sudoers file are still owned by admin, not root.

Anyone know what I can do to get this script to work? I'm running debian version 10 (buster).

1 Answer 1

0

OK, I took a closer look at the bash script that amazon has and it does not change the ownership on the file. The fix is simple. Add the following line to the end of the script (above the --// boundary):

/bin/chown root:root /etc/sudoers

You must log in to answer this question.

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