Run sudo in WSL without needing a Password
Publish date: 3. May 2022
Last updated: 2. December 2022
Last updated: 2. December 2022
This one-liner enables running elevated commands with sudo
on Ubuntu on WSL (Windows Subsystem for Linux).
echo "`whoami` ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/`whoami` && sudo chmod 0440 /etc/sudoers.d/`whoami`
It works of course also in other places, but should be strictly used for development purposes.