Cannot do sudo: "/etc/sudoers is mode 0740, should be 0440"

Posted by dehmann on Super User See other posts from Super User or by dehmann
Published on 2011-07-21T08:24:50Z Indexed on 2012/06/22 21:19 UTC
Read the original article Hit count: 275

Filed under:
|
|

I have a problem:

I don't have a root password on my mac. I just have an Admin account, which can do stuff using sudo. Now, I wanted to add my normal user to the /etc/sudoers file as well. Since it did not let me write to that file (even writing using sudo), I did this:

sudo chmod u+w /etc/sudoers

That worked. But since then I can't do any sudo command anymore on my system. It complains that /etc/sudoers has the wrong mode:

$ sudo touch /etc/sudoers 
sudo: /etc/sudoers is mode 0740, should be 0440
Segmentation fault

It sounds like a bad joke, because now I can't even change the mode back to 0440:

$ sudo chmod 0440 /etc/sudoers 
sudo: /etc/sudoers is mode 0740, should be 0440
Segmentation fault

Is there any way to fix this situation? I need to get my sudo abilities back.

© Super User or respective owner

Related posts about osx

Related posts about sudo