From aae108edd0088ca4dedf803e4616fc4f8c35eb5e Mon Sep 17 00:00:00 2001 From: Jeremy Cline Date: Tue, 18 Feb 2025 10:23:35 -0500 Subject: [PATCH] oobe: Let the user know they're in wheel and have passwordless sudo Also include the command to set a password, if they wish. --- wsl-oobe.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/wsl-oobe.sh b/wsl-oobe.sh index e406b57..ace2e51 100644 --- a/wsl-oobe.sh +++ b/wsl-oobe.sh @@ -25,7 +25,11 @@ read -r -p 'Enter new UNIX username: ' username /usr/sbin/useradd -m -G wheel --uid $DEFAULT_USER_ID "$username" cat > /etc/sudoers.d/wsluser << EOF -# Ensure the WSL initial user can use sudo +# Ensure the WSL initial user can use sudo without a password. +# +# Since the user is in the wheel group, this file can be removed +# if you wish to require a password for sudo. Be sure to set a +# user password before doing so with 'sudo passwd $username'! $username ALL=(ALL) NOPASSWD: ALL EOF @@ -36,3 +40,6 @@ cat >> /etc/wsl.conf << EOF [user] default = "$username" EOF + +echo 'Your user has been created, is included in the wheel group, and can use sudo without a password.' +echo "To set a password for your user, run 'sudo passwd $username'"