How to disable WSL password?

3

I feel there is no need for a password on WSL because it is already protected from my Windows account. Nobody could use my WSL without first knowing my Windows password.

How can I disable the WSL password? I have tried passwd but it does not accept a NULL password.

nowox

Posted 2019-08-11T09:37:00.370

Reputation: 1 779

1passwd -d is the standard way to delete a password on Linux. Can't remember if that worked without consequences on WSL. – Bob – 2019-08-11T09:54:23.767

For some reason, passwd -d doesn't work: sudo still asks for the password after that, and because there is none, you're locked out. Just had to reset my password by logging in as root because of this.

– Benjamin – 2019-09-04T21:54:01.633

This is not recommended... sudo should always require a password. The password isn't there just to prevent others from logging in to your WSL environment, it's also to prevent unauthorized privilege escalation. Please use google to understand why this is never recommened for Linux, unless it's a Single User OS where the only login account is root – JW0914 – 2019-10-15T11:27:14.903

@JW0914 Could you give me an example of some harm in WSL ? I don't think you can do privilege escalation. – nowox – 2019-10-15T11:30:29.397

Answers

1

In wsl add your username to a sudo config file.

sudo nano /etc/sudoers.d/myusername

add

myusername ALL=(ALL) NOPASSWD:ALL

Chris McKee

Posted 2019-08-11T09:37:00.370

Reputation: 121