Hi,
what’s the best practice for disabling root account in macOS?
Script and Policy sound about right but what does everyone else use?
Hi,
what’s the best practice for disabling root account in macOS?
Script and Policy sound about right but what does everyone else use?
Best answer by Phantom5
If you want to disable the 'root' user (uid 0), the following code will do just that. If instead you are trying to disable elevate privileges for admin users, then @BWonderchild script would do.
#!/bin/bash
DSCL_BIN=$(which dscl)
# Read root user authentication authority from local domain using the DSCL command line
rootEnableCheck="$(dscl . read /Users/root | grep AuthenticationAuthority 2>&1 > /dev/null ; echo $?)"
if [ "${rootEnableCheck}" == 1 ]; then
echo "No root user enabled"
else
echo "Deleting the Authentication Authority for root user"
$DSCL_BIN . delete /Users/root AuthenticationAuthority
fi
exit 0
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.