How to Change the Root User Account Password in Mac OS X

Mar 8, 2015 - 13 Comments

Change the root password 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*

  1. From the  Apple menu, choose “System Preferences”, then click on the “Users & Groups” preference panel
  2. Select the lock icon in the corner, then enter an admin password
  3. Choose “Login Options”
  4. Click the “Join” button alongside ‘Network Account Server’, then click on “Open Directory Utility” to open the app
  5. Choose the lock icon in Directory Utility app and again authenticate with an admin login
  6. From the “Edit” menu, choose “Change Root Password”
  7. 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:

Change the Root User Password in Mac OS X

You must enter the same password twice to confirm the change:

Changing the root password in Mac OS X

Do note the password change will apply to root regardless of how it was enabled, either through the command line or Directory Utility in OS X.

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.

.

Related articles:

Posted by: Paul Horowitz in Mac OS, Tips & Tricks

13 Comments

» Comments RSS Feed

  1. TacTic says:

    NOTE: Yosemite/10.10.5 the correct path to Utility.app is..

    open /System/Library/CoreServices/Applications/Directory\ Utility.app

    Regards, TacTic

    (5/2017)

  2. Great, thanks for posting – but it’s easier on Mac OS Sierra. You just click ‘Change Password’ in User & Groups.

    • Noberdeen says:

      Changing user password is not the same as changing root user password. If you don’t know the difference, you won’t be using root anyway though so that’s OK. Just stick with your main account, root is for command line advanced users.

  3. Walter says:

    and how do you undo changing the root Password ?

  4. Mahesh says:

    Very Nice….. 👍👍

  5. KURT HANSON says:

    Huh? What if I didn’t ever enable root via password? Administrator password should trip the wire, yes?

  6. Hamza Sheikh says:

    Thanks for the important tip. I already faced trouble with my older Air, and got locked out due to some bug in OS X Public beta.

  7. Earl V says:

    What is the default Root password?

  8. John Dough says:

    sudo always requires the password of the password running it. Not the root password unless you’re already running as root. In which case why use sudo unless you’re trying to run a command as non-root?

  9. bil says:

    I guess I just don’t see the need to enable root with a password. You can get to root with:
    sudo -i

    If you want root access remotely, make a public private key pair and ssh into root with that instead.

  10. Edwin Von Trimea says:

    root user should be disabled all the time for security reasons, and if it is enabled, the password should be different from the admin users on the Mac. At least, that’s standard IT protocol here.

    For a personal Mac, probably doesn’t matter quite so much, but most Mac users don’t even know what root is let alone what it’s for and why or how they’d use it, so it all comes full circle heh.

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site