sodcalculator

10 Tech How-To

Reset Windows Password with Linux

Guide 10-60911 · Updated · Step by step

This guide shows you how to reset a forgotten Windows account password using a Linux live USB drive. It works for Windows 10 and 11 with local accounts, and it does not require reinstalling Windows or losing your files. You will need a working computer with internet access, a USB flash drive (at least 4 GB), and about 30 minutes of time.

What You’ll Need

  • A USB flash drive (4 GB or larger) – all data on it will be erased.
  • A working computer with internet access to download Linux and create the bootable USB.
  • The Windows computer whose password you want to reset (it must be powered off and able to boot from USB).
  • Basic familiarity with BIOS/UEFI boot menus.

Step-by-Step

  1. Download a Linux distribution. On your working computer, download a lightweight Linux ISO such as Ubuntu, Linux Mint, or Xubuntu. Choose the LTS (Long Term Support) version for stability.
  2. Create a bootable USB drive. Use a tool like Rufus (Windows), balenaEtcher (Windows/macOS/Linux), or the built-in Startup Disk Creator (Linux). Select your USB drive and the downloaded ISO, then start the process. This will erase the USB drive.
  3. Boot the Windows computer from the USB. Insert the USB into the Windows PC, restart it, and press the key that opens the boot menu (often F12, F10, Esc, or Del) during startup. Choose the USB drive from the list. If the PC boots into Windows instead, you may need to enter the BIOS/UEFI settings and change the boot order or disable Secure Boot temporarily.
  4. Start Linux in live mode. When the Linux menu appears, select “Try Ubuntu” (or the equivalent “Live” option). Do not choose “Install” – you only need the live session. Wait for the desktop to load.
  5. Open a terminal. Once the Linux desktop is ready, open the terminal application. It is usually in the menu under “Accessories” or “System Tools,” or you can press Ctrl+Alt+T.
  6. Find your Windows partition. Run sudo fdisk -l or lsblk to list all disks and partitions. Look for the NTFS partition that contains the Windows installation – it is usually the largest partition, labeled with a size like 100+ GB, and often has a type of “Microsoft basic data” or “HPFS/NTFS/exFAT.” Note its device name, e.g., /dev/sda2.
  7. Mount the Windows partition. Create a mount point and mount the partition with read-write access. For example:
    sudo mkdir /mnt/windows
    sudo mount -o rw /dev/sda2 /mnt/windows

    (Replace /dev/sda2 with your actual partition.)

  8. Locate the SAM file. The Windows password hashes are stored in /mnt/windows/Windows/System32/config/SAM. Verify it exists with ls /mnt/windows/Windows/System32/config/SAM.
  9. Install chntpw (if not already present). Most live Linux distributions do not include chntpw by default. Install it using the package manager. For Ubuntu/Debian-based systems, run:
    sudo apt update && sudo apt install chntpw

    If you are using a different distribution, use its package manager (e.g., sudo dnf install chntpw on Fedora).

  10. Run chntpw on the SAM file. Navigate to the config directory and run chntpw interactively:
    cd /mnt/windows/Windows/System32/config
    sudo chntpw -i SAM

    This will show a list of user accounts on the system.

  11. Select the user account. Type the number corresponding to the user whose password you want to reset (e.g., 1 for the first user). Then press Enter.
  12. Choose the reset option. In the next menu, type 1 to “Clear (blank) user password” and press Enter. This removes the password, so the account will have no password after the reset.
  13. Confirm and exit. Type q to quit the user menu, then q again to exit the main menu. When asked “Write hive files? (y/n)”, type y and press Enter to save the changes.
  14. Reboot into Windows. Unmount the partition with sudo umount /mnt/windows, then shut down the Linux session. Remove the USB drive and restart the PC. Windows should boot normally, and you can log in with the selected account by leaving the password field blank.
  15. Set a new password (optional). After logging in, go to Settings > Accounts > Sign-in options and set a new password. This is strongly recommended for security.

Common Mistakes

  • Mounting the wrong partition – If you mount the EFI system partition or a recovery partition instead of the main Windows partition, you will not find the SAM file. Double-check the partition size and type.
  • Not installing chntpw – Some live systems already have it, but many do not. Skipping the installation step will result in a “command not found” error.
  • Forgetting to write changes – If you exit without typing y when prompted to write the hive files, the password will not be cleared.
  • Using the wrong user number – The list may include built-in accounts like Administrator or Guest. Select the actual account you use.
  • Leaving the USB in during reboot – The PC may boot back into Linux instead of Windows. Remove the USB when prompted.

Tips

  • Before starting, back up any important data on the Windows machine if possible – although this method does not touch files, it is always good practice.
  • This method works for local accounts only. If you use a Microsoft account to sign in, the password is stored online and cannot be reset this way – you will need to use Microsoft’s online recovery process instead.
  • If your Windows drive is BitLocker-encrypted, this method will not work because the SAM file is encrypted. You will need the BitLocker recovery key.
  • Use a live Linux USB that you are comfortable with – Ubuntu is the most common, but any distribution with a graphical interface will work.
  • Make sure the USB drive is created in the correct mode (UEFI vs Legacy) that matches your Windows PC’s firmware. Most modern PCs use UEFI.

Troubleshooting

  • PC still boots into Windows – Enter the BIOS/UEFI settings (usually by pressing Del or F2 during startup) and change the boot order to prioritize the USB drive. Alternatively, use the boot menu key (F12, F10) to select the USB directly. If Secure Boot is enabled, try disabling it temporarily, as some Linux ISOs may not boot with it on.
  • Cannot find the SAM file – If ls /mnt/windows/Windows/System32/config/SAM returns “No such file or directory,” you likely mounted the wrong partition. Run lsblk again and look for a partition with a large size (usually 100+ GB) and a filesystem type of ntfs. Mount that one instead.
  • chntpw says “hive file not found” – Make sure you are in the correct directory (the one containing SAM) before running chntpw. Also ensure the partition is mounted with read-write access (the -o rw option).
  • After reset, Windows asks for a password anyway – If the account is a Microsoft account, the local SAM file is not used for login. You will need to use Microsoft’s password reset website. If it is a local account, double-check that you selected the correct user and that the write step completed successfully.
  • “Permission denied” when running chntpw – Use sudo before the command. If the partition is mounted read-only, remount it with sudo mount -o remount,rw /mnt/windows.
  • chntpw not available in repository – If the package manager cannot find chntpw, try updating the package list first (sudo apt update). If it still fails, you can download the chntpw source and compile it, but that is more complex – consider using a different Linux distribution that includes it (e.g., Kali Linux).

Frequently Asked Questions

Will this delete my files?

No. This method only modifies the SAM file to clear the password. Your documents, photos, and installed programs remain untouched.

Does it work for Microsoft accounts?

No. Microsoft account passwords are verified online, not stored locally. You will need to use Microsoft’s official password reset process instead.

What if I have BitLocker enabled?

BitLocker encrypts the entire drive, including the SAM file. Without the recovery key, you cannot access the SAM file, so this method will not work.

Can I set a new password instead of clearing it?

chntpw can change the password, but it is unreliable and may cause issues. Clearing the password and then setting a new one from Windows is safer.

Is this legal?

Yes, as long as you own the computer or have permission from the owner. It is a standard recovery technique used by IT professionals.

What if I don’t know the username?

The chntpw interactive menu lists all local users. You can also run sudo chntpw -l SAM to list users without entering the interactive mode.

Will this work if I have Windows 11 with TPM?

Yes, TPM does not affect SAM file access. However, if BitLocker is enabled (which is common on Windows 11), you will need the recovery key.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →