5

I need to test if Mac root user is enabled or not.

I usually enable/disable it by using dsenableroot.

8
sudo dscl . -read /Users/root Password

If root is enabled it will output Password: ********, otherwise it will be just No such key: Password.

Edit: After Apple's security patch 2017 Nov 29, if root is disabled, it may output Password: *


Alternative:

sudo plutil -p /var/db/dslocal/nodes/Default/users/root.plist | grep -A 2 passwd

If the result is:

"passwd" => [
0 => "********"
]

Then root is enabled. If it's:

"passwd" => [
0 => "*"
]

then root is disabled.

  • And if the first one indicates that its enabled (with Password: * but only a single star) but the second one that its disabled? – George Mauer Nov 28 '17 at 23:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.