Single User Mode Password Reset Mountain Lion Edition

My previous article on resetting a Mac OS X password using single user mode is by far the most popular post i’ve ever made.  That is to say, people actually go there intentionally.  Unfortunately, that post was made in 2008 and is just a little out of date.  For example, it talks about 10.4.  So, in an effort to induce hapless victims to visit once again, i’m doing an updated post for Lion (10.7) and now Mountain Lion (10.8).

In my previous post I included a last ditch effort involving wiping out the user database completely and allowing the Mac OS X setup assistant to run again and create a user.  I’m going to skip that.  If you wish, my previous post is still available and, to my knowledge, you can still reset the user database that way.  This post will be about resetting an existing user’s password.

Instructions

You have elected to reset the password via single user mode.  Congratulations.  The good news is that this method is almost exactly the same as in the previous post.  The previous post did not have the world “lion” in it though so no-one found it.  Here are the instructions.

First, you need to boot into single user mode.  Shut down the computer.  Press the power button to turn it on and immediately press and hold command (apple) + “s”.  That is, the command key and the “s” key.  Hold them down until you see a command line.

Now, enter these commands:

This command re-mounts the filesystem read/write so you can make changes.

mount -uw /

Next step, we need to load the daemon responsible for providing access to the account database. This was mostly the same in previous versions.  In this version of the OS the “DirectoryServices” daemon had been replaced with “opendirectoryd” so thats what we load.

launchctl load /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist

Now the daemon is running and you have access to the database. What we’re going to do here is enable the root account. For this, we use the command “dscl”.  That command stands for “directory services command line”.  Remember how its opendirectoryd now and not DirectoryServices?  Apple apparently forgot as this command complains about it when you run it.  Ignore it.  We won’t be doing this interactive mode this time:

dscl . -passwd /Users/root "password"

Just enter your password of choice in place of “password” and your done. Type exit and then reboot to reboot into normal mode

exit
reboot

When the computer comes up, either click on other and type root for user and the password you gave or just type it in the name a password fields and voila! Superuser access. Now be careful. “With Great Power Comes Great Responsibility”. Seriously, the superuser isn’t inhibited by any permissions or many of the security features of the system. You can cause real damage and not even be warned about it with him. That said, you can also use it to ignore permissions and retrieve files or whatever you need to do.

Related Posts