Tuesday, April 30, 2024
 Popular · Latest · Hot · Upcoming
10
rated 0 times [  10] [ 0]  / answers: 1 / hits: 108834  / 3 Years ago, wed, june 9, 2021, 10:58:42

I edited my sudoers file in /etc and after that I can't use sudo anymore. I get this whenever I issue the command:



sudo: >>> /etc/sudoers: syntax error near line 30 <<<
sudo: parse error in /etc/sudoers near line 30
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin


How to solve it?


More From » sudo

 Answers
2

Boot into recovery mode from the GRUB menu (hold the SHIFT key during boot to reveal this menu), enter the root shell.




  1. First you need write permission to edit sudoers, so run



    mount -o remount,rw /

  2. Then use visudo and revert your mistake. visudo will check if the resulting sudoers file conforms to the required syntax.



    By default visudo uses vi as editor, but you can tell it to use your favourite text editor with the EDITOR environment variable, e. g.:



    EDITOR=nano visudo


[#36475] Thursday, June 10, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
gliroopy

Total Points: 290
Total Questions: 115
Total Answers: 114

Location: Egypt
Member since Tue, May 3, 2022
2 Years ago
;