10.5: Reset a user's password in single user mode

Apr 23, '08 07:30:00AM

Contributed by: tejinashi

We needed to reset the password on a Leopard system, but we didn't have the OS X install DVD available. After a few minutes of playing around, I came up with this solution:

  1. Boot into single user mode (press Command-S at power on)
  2. Type fsck -fy
  3. Type mount -uw /
  4. Type launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist
  5. Type dscl . -passwd /Users/username password, replacing username with the targeted user and password with the desired password.
  6. Reboot
This allows you to reset the password in single user mode without booting from the install media.

[robg adds: For everyone about to comment about this massive security hole, please don't do so. We ran a similar hint at the time of the OS X 10.0 release, and you can read the comments there for some of the give and take on the security issue. The bottom line is that someone with physical access has full access to your machine, regardless of whether or not they happened to bring a boot DVD with them. If you're truly worried about such things, then you'll want to use a combination of File Vault, a firmware password, and a case lock to minimize the chances that your machine is accessed.]

Comments (13)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20080414140636495