I need to test if Mac root user is enabled or not.
I usually enable/disable it by using dsenableroot.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communitysudo 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.
Password: *
but only a single star) but the second one that its disabled?
Nov 28, 2017 at 23:34