How can I reset a Mac's password from Single User Mode? [duplicate]

Solution 1:

Once you mount the file system, you should be able to use passwd username and then put in the password twice.

Solution 2:

Try loading com.apple.opendirectoryd.plist instead.

  1. Hold command-S on startup.
  2. Run mount -uw /. (fsck -fy is not necessary.)
  3. In 10.7 and later, run:

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

    or in 10.6 and earlier:

    launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist
    
  4. Run passwd username and reset the password.
  5. Run reboot.

A second way to reset the login password of an account is to use Reset Password.app from the recovery partition:

  1. Hold command-R on startup.
  2. Open Terminal from the Utilities menu.
  3. Run resetpassword, which opens the Reset Password application.
  4. Select the volume and account and reset the password.

A third way is to create a new admin account:

  1. Hold command-S on startup.
  2. Run mount -uw /.
  3. Run rm /var/db/.AppleSetupDone.
  4. Run reboot.
  5. Go through the steps of creating a new account.
  6. Reset the password of the old account from the Users & Groups preference pane.

None of these options resets the password of the login keychain.

If FileVault 2 is enabled, you have to enter a password to start up in single user mode, and you can't use Reset Password.app to reset the password of an account.

Solution 3:

I kept getting the launch_msg(): Socket is not connected message, so I used cd to get to the LaunchDaemons directory and typed in

launchctl load com.apple.DirectoryServices.plist 
passwd username

This worked. Not sure why it didn't like the directory path as it had no errors.

Solution 4:

Hold ⌘-S on startup, then type

/sbin/fsck -y
/sbin/mount -uw /
sh /etc/rc

passwd [username of account you want to change here]

It should ask you to enter the new password twice.

reboot