Open
Description
Describe the bug
While creating an Azure Linux 3.0 WSL instance, I noticed that I couldn't log in as the default (non-root) WSL user I created as root
. The error messages I received were only somewhat helpful:
sh-5.2# sudo -u danderson -i
sudo: unable to change directory to /home/danderson: Permission denied
sudo: unable to execute /bin/bash: Permission denied
I found the problem to be restricted permissions on the root directory:
sh-5.2# ls -lad /
drwxr-x--- 18 root root 4096 Aug 6 15:48 /
When I changed the permissions to 0755
, things worked correctly:
sh-5.2# chmod 755 /
sh-5.2# sudo -u danderson -i
danderson [ ~ ]$
To Reproduce
Steps to reproduce the behavior:
- Generate an AzureLinux 3.0 tarball.
- Add the tarball to WSL.
- Create a non-root user.
- Attempt to use
sudo
to change to that user
Expected behavior
I expect to be able to change to a non-root user.