Reset Bash Password in WSL (PowerShell, Win11)

Abstract: Reset a forgotten Bash password in WSL on Windows 11 using PowerShell with administrative privileges.

Created: 2026-08-12 by
You can reset your Bash password in Windows Subsystem for Linux (WSL) on Windows 11 by launching PowerShell with administrative privileges and using the wsl command to execute passwd directly. This method bypasses the standard login prompt, allowing you to set a new credential for your Linux user account without needing the old one, ensuring immediate access to your WSL environment.

Prerequisites for Password Reset

Before attempting to change your credentials, ensure that you have administrative rights on your Windows machine. The process requires elevated permissions because it modifies system-level configurations within the WSL distribution. Additionally, verify that your WSL instance is properly installed and registered with Windows. You can check this by running wsl -l -v in PowerShell to see if your Ubuntu or other Linux distribution is listed as running or stopped. If the distribution is not present, you may need to install it first via the Microsoft Store or using wsl --install.

Step-by-Step Guide Using PowerShell

The most reliable way to reset the password is through PowerShell. Follow these steps carefully to avoid errors.
  1. Open PowerShell as Administrator: Right-click the Start button and select "Terminal (Admin)" or search for PowerShell, right-click it, and choose "Run as administrator". This step is critical; standard user privileges will result in permission denied errors when trying to modify user accounts.
  2. Identify Your Distribution Name: Run wsl -l -v to list all installed distributions. Note the exact name of the distribution you want to reset, such as Ubuntu-20.04 or Debian.
  3. Execute the Password Change Command: Use the following syntax, replacing DistributionName with your actual distribution name:
    wsl -d DistributionName passwd
    For example, if your distribution is named Ubuntu-20.04, the command would be:
    wsl -d Ubuntu-20.04 passwd
    This command launches the passwd utility inside your WSL environment, prompting you to enter a new UNIX password twice.
  4. Confirm the New Password: Type your new password carefully. Note that Linux terminals do not display characters as you type for security reasons. Press Enter after typing the password twice to confirm.
After completing these steps, your password has been successfully changed. You can now log into your WSL distribution using the new credentials. If you encounter issues, ensure that no other processes are locking the WSL instance. Sometimes, stopping the distribution before changing the password helps, though it is usually not required for simple password resets.

Troubleshooting Common Issues

Users often face specific hurdles during this process. Understanding these common problems can save time and frustration.

Permission Denied Errors

If you receive a "permission denied" message, it almost always means you did not run PowerShell as an administrator. Ensure you have elevated privileges. Another cause could be that the WSL service is corrupted. In such cases, restarting the WSL service via wsl --shutdown followed by reopening PowerShell might resolve the issue.

Distribution Not Found

If the command fails because the distribution name is incorrect, double-check the output of wsl -l -v. The name must match exactly, including capitalization and hyphens. For instance, Ubuntu is different from Ubuntu-20.04. Using the wrong name will result in an error stating that the distribution does not exist.

Password Prompt Does Not Appear

In rare cases, the terminal might not prompt for input due to redirection issues. Ensure you are running the command in a standard PowerShell window and not piping output elsewhere. If the prompt seems stuck, try closing and reopening the PowerShell window as administrator.

Alternative Methods and Considerations

While PowerShell is the recommended approach, there are alternative ways to manage WSL users. You can also use the Windows Terminal application, which provides a unified interface for multiple shells. However, the underlying mechanism remains the same: executing passwd within the WSL context. It is important to note that resetting the password does not affect your files or settings within the Linux distribution. Your home directory, installed packages, and configurations remain intact. However, if you have enabled SSH within WSL, you may need to update your SSH keys or configurations if they rely on password-based authentication, although key-based authentication is generally preferred for security. For more information on managing network services in WSL, you might find it useful to read about Unable to start SSHD using PowerShell, as secure shell access often requires valid credentials. Additionally, if you experience performance issues like jerky scrolling after making system changes, refer to Jerky Scrolling in Ubuntu to optimize your graphical experience.

Frequently Asked Questions

Can I reset the root password instead of my user password?

Yes, you can reset the root password by specifying the root user in the passwd command. Use wsl -d DistributionName passwd root to change the root password specifically. This is useful if you have forgotten the root credentials but know your user password.

Does resetting the password delete my data?

No, resetting the password only updates the authentication credentials stored in the /etc/shadow file. All your personal files, applications, and system configurations remain unchanged and accessible after the reset.

What if I forget both my user and root passwords?

If you cannot recall any passwords, you may need to boot into recovery mode or use a live USB to mount the WSL virtual disk and manually edit the shadow file. This is a more advanced procedure and should be done with caution to avoid corrupting the system.

Is it safe to use special characters in my new password?

Yes, Linux supports special characters in passwords. However, ensure that your password does not contain characters that might interfere with the shell interpretation if you plan to use it in scripts. Strong passwords with mixed case, numbers, and symbols are recommended for security.

Why does my WSL distribution show as stopped?

WSL distributions automatically stop when idle to conserve resources. This is normal behavior and does not affect your ability to reset the password. You can start the distribution manually using wsl -d DistributionName if needed, but the passwd command works regardless of its running state.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More