Discussion Forums
Advanced search options
Sudoers File Corrupted
Posted by: eduardomariano_br
Posted on: Sep 10, 2014 5:04 AM
  Click to reply to this thread Reply
This question is not answered. Answer it to earn points.
Hi, I did a bad change in sudoers file, so i can not be root , i can not use sudo or su - ( i do not know root password)
aa@bb:/opt//bin $sudo su -
sudo: >>> /etc/sudoers: syntax error near line 142 <<<
sudo: parse error in /etc/sudoers near line 142
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
aa@bb:/opt//bin

How can I correct this file ?
Thank You
Permlink Replies: 1 | Pages: 1 - Last Post: Sep 10, 2014 12:39 PM by: David
Replies
Re: Sudoers File Corrupted
Posted by: David
Posted on: Sep 10, 2014 12:39 PM
in response to: eduardomariano_br in response to: eduardomariano_br
  Click to reply to this thread Reply
If your instance is EBS-backed, you can stop it, temporarily attach its root drive to another instance, and fix the sudoers file. Details here: https://aws.amazon.com/articles/5213606968661598

To avoid this problem in the future, obey this warning from the sudoers(5) man page: "The sudoers file should always be edited by the visudo command which locks the file and does grammatical checking. It is imperative that sudoers be free of syntax errors since sudo will not run with a syntactically incorrect sudoers file."