A customer recently brought me an old Mac G4 notebook for which he had forgotten the password. He wanted me to reset it for him somehow. Now that we have the Internet you would think this kind of thing would be easy to Google. Unfortunately, because different versions of OS X seem to have different ways of resetting a password this isn’t as straight-forward as it seems.
The advice offered by the friendly denizens of the Internets falls into three broad categories:
- Reset the user’s password in single user mode with the passwd program
- When the notebook boots hold down the Apple+S keys until you see a black and white terminal
- You are now in single user mode
- At the prompt type:
# fsck -y # /sbin/mount -uw / # sh /etc/rc or # /sbin/SystemStarter # passwd <short username>
- This didn’t work for me. After the “passwd …” command it silently returned me to the command line.
- Trick OS X into thinking this is the first time it’s running
- In single user mode type:
# fsck -y # /sbin/mount -uw / # rm /var/db/.AppleSetupDone
- After it reboots it will behave like this is the first time it has ever run and take you through it’s First-Run Wizard, which will allow you to create a new administrative user that can reset the old user’s password from within OS X itself
- This didn’t work for me at first, but did work the second time arround when I tried it again before writing this post. Meh, probably “UserError” on my part. Anyways, it is less elegant and clean than simply resetting a password
- Reset the password from single user mode using the dscl command
- In single user mode type
# fsck -y # /sbin/mount -uw / # launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryService.plist or # launchctl load /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist # dscl . passwd /Users/<short username> # reboot
- This apparently only works on more recent versions of OS X, such as Leopard and Lion (which this one is not)
At this point I was just about ready to give up and toss it back to its owner with a curt –“Just wipe it clean and start fresh” response when I came across this thread, which finally solved my problem. If you’ve read this far already, here’s how I finally managed to reset the password:
# fsck -y # /sbin/mount -uw / # /sbin/SystemStarter # /usr/libexec/register_mach_bootstrap_server /etc/mach_init.d # cd /var/db/netinfo # netinfod -s local # passwd <short username>
What the #$%&! I would-a-never figured this out in a million years!