3

I have a WSL distro installed on a non-admin Windows account.

Some WSL operations require privilege elevation (e.g. --mount --bare).

But the admin account can't see the non-admin user's distro. This github issue states that it is normal:

This is the expected behavior: Distributions are installed per user and not per machine.

So, how can I run my WSL elevated operation on the distro, beside granting admin rights to that user (which I do not wish to do)?

Environment: Windows 10 22H2 [version 10.0.19045.4170] WSL 2.1.5.0

1 Answers1

3

This question was raised in bug-report Mounting a Linux disk requires administrator priviledges #6414.

The answer by user OneBlue was as follows :

When a partition is attached to WSL2, even though only the partition is mounted, the entire disk has to be detached from Windows and attached to WSL2.

By design, administrator access is required to do that, because users have root access in WSL, so wsl --mount could be used to bypass the filesystem ACL's if the user doesn't have administrator access.

This is a security consideration, because mounting the disk gives the WSL user an administrator access to all the files on it, so security is completely bypassed.

There exist products that allow running specific applications as Administrator without the user knowing the administrator password. Such a product can perhaps solve your problem, by running the wsl --mount.

Some free products that do that :

  • RunAsTool

  • RunAsRob

  • Run As GUI
    This link is to the Internet Archives, as the original website has disappeared. You need to right-click on the Zip file to download.

harrymc
  • 498,455