How to turn on "sudo" in OSX 10.12 Sierra
Open up Terminal and enable root with:
dsenableroot -u <your_admin_username> -p <your_password> -r <root_password> #choose some root password here
If the sudoer's is damaged, you still won't be able to sudo
- but you will be able to su
and repair the permissions accordingly:
su #when asked afterwards enter the above <root_password>
chown root:wheel /etc/sudoers
chmod 440 /etc/sudoers
chmod -a "admin allow read,write,append,readattr,writeattr,readextattr,writeextattr,readsecurity" /etc/sudoers
exit
Back in your admin account disable root:
dsenableroot -d -u <your_admin_username> -p <your_password>
In case the above won't help, re-enable root account doing the same as above, logut of your account, login as root
(yup, really):
Open terminal and type chmod g+x /
, close the term, logout and tada, sudo is working again :) This problem happens mostly when you mount your /
through linux in rw mode (for hfsplus
in r/w mode use fuse and bindfs
)
BTW the group admin ACL doesn't seem to harm the sudoers file!