Enable or disable the root account.
Syntax dsenableroot [-d] [-u username] [-p password] [-r rootPassword] Key -u Username of a user that has administrative privileges on this computer. -p Password to use in conjunction with the specified username. If this is not specified, you will be prompted for entry. -r Password to be used for the root account. If this is not specified for enabling, you will be prompted for entry.
dsenableroot sets the password for the root account if enabling the root user account. Otherwise, if disable [-d] is chosen, the root account passwords are removed and the root user is disabled.
Sets a password and enable the root account, your username will be used and you will be queried for both your
password and the new root password:
Disable the root account, your username will be used and you will be queried for your password.
$ dsenableroot -d
The supplied arguments will be used to enable the root account:
$ dsenableroot -u fred -p flintst003 -r rootpa55w0rd
The supplied arguments will be used to disable the root account:
$ dsenableroot -d -u fred -p flintst003
"Make mistakes, make mistakes, make mistakes. Just make sure they’re your mistakes” ~ Fiona Apple
Related macOS commands:
groups - Print group names a user is in
passwd - Modify a user password