I accidentally messed up my sudoers file earlier and started getting the following error:
>>> /etc/sudoers: syntax error near line 1 <<<
sudo: parse error in /etc/sudoers near line 1
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
I tried to do what this post told me to: https://astrails.com/blog/2009/09/29/how-to-fix-a-hosed-etc-sudoers-file-on-mac-osx
I ran vim /etc/sudoers
, and saw a blank file with only two curly brackets there, like so:
{
}
~
~
~
~
I tried to comment out the curly braces, saved the file (despite "read-only" warnings), exited, and ran sudo visudo, which gave me this error:
john is not in the sudoers file. This incident will be reported.
It seems I've been locked out of sudo. Is there any way this can still be fixed? I'm on a 2017 mac running Mojave 10.14.4. I know I shouldn't have messed with the file but just got curious...