2 Answers
- Newest
- Most votes
- Most comments
1
I FIXED IT! You basically build an instance from a snapshot, but add a launch script which runs as root to change the permissions on your sudoers file. Then you can edit sudoers as a non root user. Then you make another snapshot instance with another launch script that sets the permissions back to normal.
- create a snapshot of your instance
- create a new instance from the snapshot, but click on the +Add Launch Script
- add the following launch script: chmod 777 /etc/sudoers
- Connnect to the instance and modify your sudoers file back too normal (you may have to wait a few seconds for the launch script to apply the permission change)
- reboot
- create a snapshot of the instance
- create another instance from the new snapshot, click on +Add Launch Script
- add the following launch script: chmod 440 /etc/sudoers
- Connect to the instance and test sudo -s (you may have to wait again for the launch script to apply the permission change)
- Detach IP from original instance. Attach to new instance
- Reset all firewall rules
- Delete other instances
answered a year ago
0
oh man that's a weird coincidence, I just did exactly the same thing tonight! I mangled my sudoers file cause I forgot I was supposed to use visudo not nano. Watching this for answers...
answered a year ago
Relevant content
- asked 2 years ago
- asked 5 years ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 9 months ago
Worked perfectly - Thanks!