If Tyranny and Oppression come to this land, it will be in the guise of fighting a foreign enemy
James Madison (American 4th US President (1809-17), and one of the founding fathers of his country. 1751-1836)

Thursday, March 13, 2008

Handy way to reset a Mac password

I have no idea if this still works on the newer models of the Mac Laptops, but it sure came in handy a few times over the last few weeks with a few friends. This method is all over the web, but for my own purposes I will post it here as the method that works best for me:

1. Click Restart at the login window
2. While the computer is restarting, hold down "Command-S" until you see text scrolling through the window. This boots the computer into single user mode.
3. At the Localhost% prompt type:
/sbin/mount -uw /
You will then see various services starting up.
4. When the Localhost% prompt reappears, type:
passwd root
It will then ask you to type the new root password twice, so do so.
5. After entering the new password, type:

1. First, you'll need to reboot into single-user mode. This boots your Mac into a text-only mode (you might be familiar with this experience if you've ever had to run fsck). You'll see instructions on how to run the file system check -- fsck -- and then a command prompt. Enter the command mount -uw / so that we can make changes to the disk.
2. Next, you need to be able to make changes to the users' accounts on your Mac in order to reset your password, and we'll do that with NetInfo. Start NetInfo by typing Systemstarter. You'll see a pile of messages appearing, which might seem familiar to you if you've ever watched the startup progress bar. When you see the message System started. and a stationary cursor, hit Return. You'll see the shell prompt appear again.
3. Now that NetInfo is running, we can change our lost password. If you don't know the short username for your account (for example, 'jane' instead of 'Jane Doe'), you'll need that - enter the command niutil -list . /users and hit Return, to see the names of the accounts on your Mac.
4. Now that you know the name of the account you want to use, enter the command passwd user -- where user is the short name of the account you're changing. You'll be told that you're changing the password for user and asked to enter it twice. Do this, being careful with your typing: you won't see the characters you're typing, or stars. Watch that Caps Lock key, while you're at it.
5. Now type reboot and press Return once more to reboot your Mac. You should now have no problem logging in.

HOWTO: Reset a lost OS X password
I've you've forgotten your Mac's admin account password, don't worry. Assuming you haven't locked out OpenFirmware, it's a pretty simple task to change your password back to something you know.
Here's how:
* Hold Apple+S when booting to enter single user mode
* #sh /etc/rc
* #passwd yourusername
* #reboot
If you can't recall your user name, you can either look in the /Users folder (the directories are named by user), or run "niutil -list . /users".
Also, on older systems the /etc/rc script isn't available, apparently. If that second step fails, try mounting and starting the base services manually:
* #/sbin/fsck -y
* #/sbin/mount -uw /
* #/sbin/SystemStarter
I've had to do this a couple of times for friends when they've bought a second hand machine, and once when I had a momentary brain lapse and forgot my own password. Works like a charm, though you'll loose any passwords stored in your keychain.

No comments: