Skip to content

Azure Linux sets permissions of root directory to 0750 by default, preventing non-root users from logging in #10042

Open
@surfacepatterns

Description

@surfacepatterns

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:

  1. Generate an AzureLinux 3.0 tarball.
  2. Add the tarball to WSL.
  3. Create a non-root user.
  4. Attempt to use sudo to change to that user

Expected behavior
I expect to be able to change to a non-root user.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions