<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Rashidat Sikiru</title>
    <description>The latest articles on Forem by Rashidat Sikiru (@rashidat_sikiru).</description>
    <link>https://forem.com/rashidat_sikiru</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3829932%2Fa43a9971-2b7a-4921-ba8a-8e52fec81137.png</url>
      <title>Forem: Rashidat Sikiru</title>
      <link>https://forem.com/rashidat_sikiru</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/rashidat_sikiru"/>
    <language>en</language>
    <item>
      <title>How to Reset Your Forgotten WSL Password (Quick Fix)</title>
      <dc:creator>Rashidat Sikiru</dc:creator>
      <pubDate>Mon, 06 Apr 2026 09:31:49 +0000</pubDate>
      <link>https://forem.com/rashidat_sikiru/how-to-reset-your-forgotten-wsl-password-quick-fix-2knc</link>
      <guid>https://forem.com/rashidat_sikiru/how-to-reset-your-forgotten-wsl-password-quick-fix-2knc</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;I've had to do this three times now, so I finally wrote it down. If you use WSL inside VS Code and keep forgetting your Linux password (it happens!), this is your go-to reference.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;WSL (Windows Subsystem for Linux) has its own separate password from your Windows login. If you rarely run &lt;code&gt;sudo&lt;/code&gt; commands, it's easy to forget, and when you need it (like installing a Python package), you're stuck.&lt;/p&gt;

&lt;p&gt;Here's how to reset it in under two minutes.&lt;/p&gt;




&lt;h2&gt;
  
  
  What You Need
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A Windows PC with WSL installed&lt;/li&gt;
&lt;li&gt;Access to &lt;strong&gt;Windows&lt;/strong&gt; Command Prompt or PowerShell (not the WSL terminal)&lt;/li&gt;
&lt;li&gt;Your WSL distro name (e.g. &lt;code&gt;Ubuntu&lt;/code&gt;, &lt;code&gt;Ubuntu-22.04&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Method 1: Reset via Root Login (Recommended)
&lt;/h2&gt;

&lt;p&gt;Open a &lt;strong&gt;Windows&lt;/strong&gt; Command Prompt or PowerShell, not your WSL terminal.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1 — Find your distro name
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wsl &lt;span class="nt"&gt;--list&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note the name shown (e.g. &lt;code&gt;Ubuntu&lt;/code&gt; or &lt;code&gt;Ubuntu-22.04&lt;/code&gt;).&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2 — Log in as root
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wsl &lt;span class="nt"&gt;-d&lt;/span&gt; Ubuntu &lt;span class="nt"&gt;-u&lt;/span&gt; root
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Replace &lt;code&gt;Ubuntu&lt;/code&gt; with your actual distro name.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Step 3 — Reset your password
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;passwd your-username
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Type your new password twice when prompted. You won't see characters as you type — that's normal.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4 — Exit and verify
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;exit&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Reopen your WSL terminal normally. You can now &lt;code&gt;sudo&lt;/code&gt; with your new password.&lt;/p&gt;




&lt;h2&gt;
  
  
  Method 2: Change Default User to Root (If Method 1 Doesn't Work)
&lt;/h2&gt;

&lt;p&gt;Run these in &lt;strong&gt;Windows PowerShell&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Set root as the default WSL user temporarily:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;ubuntu&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--default-user&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;root&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Open WSL, then reset your password:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;passwd your-username
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Restore your normal user as default (back in PowerShell):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;ubuntu&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--default-user&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;your-username&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  How to Never Get Stuck Again
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Use a password manager&lt;/strong&gt; —WSL credentials are separate from Windows, so store them in Bitwarden, 1Password, etc.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bookmark this article&lt;/strong&gt; — seriously, just do it 😅&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Tested on WSL 1 and WSL 2, Windows 10 and Windows 11.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>beginners</category>
      <category>windows</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
