HELP!!!! screwed up /etc/sudoers
I edited /etc/sudoers and now it no longer works. I can't sudo anything, including editing /etc/sudoers.
Gives an error like:
sudo: parse error in /etc/sudoers near line 30
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
I cannot run
pkexec visudo
because I do not have it installed, and i cannot install it because I cannot sudo anything.
And yes, this is a production server. Not a high volume of usage, but still…
Is there any way to edit sudoers, or gain root access or am I totally screwed?
4 Replies
Or if you know the root login, you can login on the lish console for the same effect.
2. You can try using the "reset root password" feature in Linode Manager (will reboot the server).
3. If that doesn't work, use the Rescue function to reboot the machine into Finnix, and edit /etc/passwd and/or /etc/sudoers to taste.
4. Starting from today, do not edit /etc/passwd, /etc/group, and /etc/sudoers manually. Use the "vipw", "vigr", and "visudo" commands respectively. Won't help for misconfiguration, but will at least protect you from syntax errors.
You are a lifesaver. Was able to use lish as root and avoid a reboot. THANK YOU!!!!
Thank you for your response and the tips. I will learn those commands. It's actually amazing that I hadn't screwed up that file previously while editing.