Changing password requirements in Linux Subsystem for Windows (or Bash on Ubuntu on Windows)

While I understand the reasoning, it’s a bit annoying needing to set a secondary password in the Bash on Ubuntu on Windows instance. If you’re on a domain joined computer, or occasionally update your password like you should, there’s a reasonable chance that the password you use for Bash is different than the one you use for general access to your PC. In fact, it’s probably likely.

Since I have a number of Windows boxes I frequently use, I wanted to create a password that while different from machine to machine, would be easy to remember (and not the same from machine to machine). However, the password I’d wanted to use didn’t always meet the default password requirements.

So, here’s what I did. From the Bash prompt, I first tried to change the password to see if my new password met the complexity and length requirements. If your password works, there’s no more to do!

$ passwd

Results:

(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
You must choose a longer password

OK. So, I needed to change the requirements. I used the editor nano.

$ cd /etc/pam.d/
$ sudo nano common-password

To save the file, use CTRL+O to write out changes, hit ENTER, then CTRL+X to Exit.

Look for the line:

password        [success=1 default=ignore]    obscure  pam_unix.so sha512

And replace it with (I removed obscure and added minlen=1):

password        [success=1 default=ignore]      pam_unix.so sha512 minlen=1

Now, try changing the password again using passwd.

$ passwd
Changing password for aaron.
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Done.

Hopefully I’ll remember to look here the next time I set up Windows and Bash on Ubuntu on Windows (gee, that’s a mouthful!). And more importantly, I won’t encounter this experience again:

$ sudo apt-get update
[sudo] password for aaron:
Sorry, try again.
[sudo] password for aaron:
Sorry, try again.
[sudo] password for aaron:
Sorry, try again.
sudo: 3 incorrect password attempts