Back online 08/04/2021 | website/CMS in HEAVY development | content revival from old DB in progress

Fixing sudo on macOS

by Antoine - Categories : OS Apple


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

...and you need a quick fix. It may be a permission problem on the root directory.

How to fix sudo in 3 command lines

You need to be logged in as an administrator (or use the -u adminaccountname switch on the following command). Open a terminal and enable root if not done yet.

$ dsenableroot
username = antoine
user password:
root password:

You'll have to type your user password et give root a password (can be the same). Once you did, "log in" as root.

$ su

Fix the root "/" directory permissions

# chmod go+rx-w /

Done, sudo works.


Be the first to comment !

0