anish
anish

Reputation: 7422

how to fix broken sudoers file without root

How to fix broken sudoers file in rhel6, it's not allowing me to get into sudo

 [bash ~]$ sudo su
sudo: >>> /etc/sudoers: syntax error near line 109 <<<
sudo: >>> /etc/sudoers: syntax error near line 109 <<<
sudo: parse error in /etc/sudoers near line 109
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

I cannot edit this file as the permission is not there and this is virtual machine

Upvotes: 0

Views: 7888

Answers (2)

Linuxian
Linuxian

Reputation: 106

I know answering to this question is too late but it might be helpful to someone in the future.

instead of opening with sudo on terminal type visudo and edit the sudoers file.

Upvotes: 1

osdamv
osdamv

Reputation: 3583

From the redhat docs

What can you do if you forget your root password? To reset it to a different password, boot into rescue mode or single-user mode, and use the passwd command to reset the root password.

then with root access you can fix the sudoers file

Upvotes: 1

Related Questions