You lose your Windows password(s) and cannot log in to your machine. If you have a rescue disk, you should be okay. If not, you might have to turn to Linux for help.

The method that I describe in this tutorial can work with a Windows machine that either dual boots with Linux or does not. If the machine in question does not dual boot, you will need to download a live edition of a Linux distribution (I prefer Ubuntu for the task) and burn that ISO image to a disk (you could also use a Linux distribution on a USB drive). Either way, you will need to boot in to Linux to recover your password.

Step 1: Boot in to Linux

Put the burned disk in the drive (or boot from USB) and boot in to the Live edition of Linux. You should use the standard Live session.

Double-click the icon to open the Windows drive (or partition) and make note of where the drive is mounted (it will be listed in the location bar).

Figure A

The drive in question on my system is the far left icon. (Click the image to enlarge.)

Step 3: Get to the command line

It's time to open a terminal window and begin (or continue) your journey into the Linux command line. You must install the small tool called chntpw. To install this application, issue the command: sudo apt-get install chntpw. With that application installed, you are ready to go. Follow these steps to get the password changed:

Change into the directory containing Windows with the command cd /PATH/TO/WINDOWS (PATH/TO/WINDOWS is the complete directory path to your Windows drive).

Change into the Windows/System32/config directory.

Issue the command sudo chntpw SAM.

You should now see the chntpw screen (Figure B). Here you have five options:

Clear user password

Edit user password

Promote user (make user an administrator)

Unlock and enable user account

Quit

Figure B

You do not want to make changes here, because this could wipe all users' passwords — make sure you are working with a specific user. (Click the image to enlarge.)

Enter "q" for quit. We're going to make sure we are working with a specific user. To list out all users in the SAM file, issue the command sudo chntpw -l SAM. This will list out all of the users on the system. As you can see in Figure C, my name is listed as one of the users.
Figure C

This listing will also tell you how many failed login attempts have been made. (Click the image to enlarge.)

To work with a specific user, issue the command sudo chntpw -u "USER NAME" SAM (USER NAME is the actual username). If the username is only one word, you will not need the quotes. If the username is a full name, place it within quotes or the command will not work. Once you are back in the edit screen, do the following:

Type "2" (no quotes) to go into edit mode.

Type the new user password.

Hit the Enter key.

Type "y" (no quotes) followed by Enter to write the file.

Your Windows User password should be changed. Reboot into Windows to make sure the edit worked. If it did not work, go through the steps once again and, this time, blank the password instead of editing it. To blank the password, do the following:

Enter the edit screen for the specific user.

Type "1" (no quotes).

Hit Enter.

Type "y" (no quotes).

Hit Enter.

At this point the user account should have no password. You can reset the password once you successfully log in to Windows.

Related Topics:

About Jack Wallen

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website jackwallen.com.

Full Bio

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website jackwallen.com.