Bug 415

Summary: chmod on "sudoers" can't be undone
Product: Sudo Reporter: Karl Woelfer <kwoelfer>
Component: SudoersAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED INVALID    
Severity: high    
Priority: low    
Version: 1.8.0   
Hardware: PC   
OS: Linux   

Description Karl Woelfer 2010-07-07 21:06:46 MDT
With admin privileges, changed mode of sudoers file from 440 to 666. Vi edited the file and saved. Cannot change mode back to 0440.

sudo:/etc/sudoers is mode 0666, should be 0440.

I need to recover, i.e. backup to pre-edited sudoers, but how do I proceed? Vi-entered changes are not important.

Thank you,
Karl Woelfer
Comment 1 Todd C. Miller 2010-07-08 07:02:05 MDT
This is why you should use visudo to edit the sudoers file--it will validate the file and make sure the mode is correct.  You'll need to login as root and change the mode of /etc/sudoers to 0440.  Sudo will refuse to run if sudoers has a file mode that is not secure.