How to reset a Windows password with Linux

How to reset a Windows password with Linux

Lost your Windows login? The chntpw utility can save the day.

2 windows with brown frames on a white exterior wall
Image by : CC BY-SA 4.0

Subscribe now

Get the highlights in your inbox every week.

If you (or someone you know) ever forget your Windows password, you'll be glad to know about chntpw, a neat Linux utility that you can use to reset a Windows password. For this how-to, I created a Windows virtual machine and set the password to pass123 on my user account, Archit-PC. I also created a Live USB with Fedora 27 using the Fedora Media Writer application.

Here are the steps, along with screenshots, to guide you through the quick and super easy process of resetting your Windows password with chntpw.

1. Attach the Live USB to your PC and restart from the login screen, as shown below:

2. Boot from the Live USB and click on Try Fedora:

3. Log out from live-user and log into root. This step is not necessary, but I prefer to use the root user to bypass any permission issues:

4. Install the chntpw utility with the following command (you'll need a live internet connection for this):

sudo dnf install -y chntpw

5. Check which partition should be mounted by sfdisk -l ...:

and mount that partition (e.g., /dev/sda2) with the following command:

sudo mount /dev/sda2 /mnt/Microsoft/

Change the current directory to the config directory:

cd /mnt/Microsoft/Windows/System32/config/

Also, check the user records in the Security Account Manager (SAM) database:

6. Edit the SAM database with the command:

sudo chntpw -i SAM

Then type 1 (for Edit user data and passwords):

And type your user account name (i.e., Archit-PC in this example) for the username:

7. Type 1 to clear the user password or 2 to set a new password for the Archit-PC user, then quit and save the changes:

8. Reboot to Windows. If you selected 1 above, you'll see there's no password required to log in. Just click Sign in and you will be logged in:

That's all there is to it! I hope this will be helpful if you ever need to reset a Windows password.


About the author

Archit Modi - OpenStack enthusiast. Linux and Networking guy. Just trying to give my two cents in this billion-trillion dollar "Open Source" world.