2 個答案
- 最新
- 最多得票
- 最多評論
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
已回答 2 年前
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...
已回答 2 年前
相關內容
- AWS 官方已更新 3 年前
- AWS 官方已更新 9 個月前
- AWS 官方已更新 7 個月前
Worked perfectly - Thanks!