7

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

I usually enable/disable it by using dsenableroot.

0

1 Answer 1

10
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.

1
  • And if the first one indicates that its enabled (with Password: * but only a single star) but the second one that its disabled? Nov 28, 2017 at 23:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .