How to Change the Root User Account Password in Mac OS X
Some advanced Mac users require having the root user enabled in Mac OS X for administrative or troubleshooting purposes. While many will keep the root user account password the same as their general administrator password, this is not always recommended for some situations, and thus these Mac users may wish to change the root user account password in Mac OS X.
To be perfectly clear, this means that the root login account could have a different and unique password from a systems administrator account. Of course it could be the same as well, but because there is potential for differing passwords, be sure to not forget one or the other, otherwise you could run into some trouble. Again, this is only appropriate for advanced Mac users who have a reason to be using the root user account to begin with. This is not the same as changing an admin users password, which are completely separate user accounts from the superuser root.
There are a few ways to change the root user password in Mac OS X, we’re going to show you how to change it with the Directory Utility application that was used to enable the root account in the first place.
Changing root Password on Mac with Directory Utility
Directory Utility can be accessed through the preference panel or directly*
- From the Apple menu, choose “System Preferences”, then click on the “Users & Groups” preference panel
- Select the lock icon in the corner, then enter an admin password
- Choose “Login Options”
- Click the “Join” button alongside ‘Network Account Server’, then click on “Open Directory Utility” to open the app
- Choose the lock icon in Directory Utility app and again authenticate with an admin login
- From the “Edit” menu, choose “Change Root Password”
- Enter the old root password, then confirm the new root password login to finalize the password change
* Note that you can also jump immediately to Directory Utility app from the command line with the following syntax:
open /System/Library/CoreServices/Directory\ Utility.app/
Directory Utility looks the same in all versions of OS X and the Edit menu will always include the ability to change root password:
You must enter the same password twice to confirm the change:
Obvious to longtime users, the root user account login will always be ‘root’, it’s only the password that will change. This us unlike a more general administrative login account in OS X where the admin account username and password may change, depending on the login credentials for a given user account.
As already mentioned, this means you can set a different password for the broader root login from any administrator level account. Or the passwords can be the same, it’s up to you and what is most appropriate for your situation.
Remember that once you change the root account password it will be necessary to enter the new password anytime the sudo command is invoked, or anytime a user wishes to login directly with the root user. This applies to anything using root from the command line or the general OS X GUI, whether executing scripts, command strings, launching GUI apps as root, or whatever else is requiring direct root usage.