If you messed up with sudoers (happened to me a lot of time, luckily only in container in docker ;) ), there is a possibility to repair it as root
user.
While rebooting, you need to:
- boot to the recovery mode,
- mount the root
/
filesystem with write permissions mount –o rw,remount /
and
- repair the
/etc/sudoers
file with your preferred command line text editor, e.g. with vim
or nano
.
How to go to the recovery mode and mount the root /
with write permissions is written e.g. here (there is also written how to change your password, if you have forgotten it (happened to me also a few times :D )).
Then just try to rewrite the sudoers file according to your wishes (always, but really always CHECK sudoers
file with visudo -c
on command line. The BEST would be before closing it!!! (if you are root, then it doesn't matter) It can save you a few minutes...)
Good luck and let us know, if you managed to do it :)