Maciej A. Czyzewski Blog Talks About

Fixing sudo on OS X, tricky method

Posted on

Sudo

If your sudo does not work anymore and displays something like:

sudo: can't open /private/etc/sudoers: Permission denied
sudo: no valid sudoers sources found, quitting

Looks matter seriously, do not worry…

Solution

First, you need to be logged in as an administrator, open a console and enable root if not done yet.

$ dsenableroot

You’ll have to type your user and password, and set root a new password…

Now, you can log in as root…

$ su

Last step is fixing the root “/” directory permissions:

$ chmod go+rx-w /

Yeah, it’s good time to repair your sudoers file using visudo