I made the following change in the file /etc/sudoers:
sudo ALL=(ALL) NOPASSWD:ALL
And now I can't use sudo and can't edit /etc/sudoers anymore:
/etc/sudoers: near line syntax error 31 <<<
sudo: parsing error in /etc/sudoers near line 31
sudo: no valid sudoers source found; going out
sudo: unable to initialize policy plugin
Is there a way to solve this problem or will I have to format my ubuntu 20.04?
sudo visudo
to edit the file: you can also dosudo visudo -f /path/to/file
when fixing your current file. – Charles Green Feb 04 '22 at 20:00/etc/sudoers
file becomes the EOF (end-of-file) marker; which is why thevisudo
command exists; ie. it will validate for errors & let you correct before exit if error(s) exist. FYI: yeah it'svisudo
but it will use whatever editor you've told it to, which may not bevi
– guiverc Feb 04 '22 at 21:06pkexec visudo
. See for example How to modify an invalid '/etc/sudoers' file? – steeldriver Feb 04 '22 at 21:20root
shell open on another tetminal/ssh session when one is futzing with authentication stuff. This gives one a chance of recovery without booting from a Live USB. – waltinator Feb 04 '22 at 23:21