Mount a drive into WSL distro owned by a restricted user
- Dominant language
- C++
- Stars
- 33.7k
- Forks
- 1.8k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 116
Description
**Is your feature request related to a problem? Please describe.**
I use Windows and WSL as a restricted user. However, mounting drives is only possible for Windows elevated admin account.
I have access to admin account. However, it does not have access to restricted user's WSL distrubutions.
**Describe the solution you'd like**
A way to mount a drive into restricted user WSL distributions, given user has access to elevated admin account.
**Additional context**
Restricted user:
```
C:\Users\User>wsl.exe -l -v
NAME STATE VERSION
* Ubuntu Running 2
Alpine Stopped 2
Ubuntu-20.04 Stopped 2
C:\Users\User>wsl.exe --mount \\.\PHYSICALDRIVE1 --partition 1
Administrator access is needed to mount a disk.
Error code: Wsl/Service/AttachDisk/WSL_E_ELEVATION_NEEDED_TO_MOUNT_DISK
```
If Admin has no installed distributions:
```
C:\Windows\system32>wsl.exe --mount \\.\PHYSICALDRIVE1 --partition 1
This operation is only supported by WSL2.
Error code: Wsl/Service/AttachDisk/WSL_E_WSL2_NEEDED
C:\Windows\system32>C:\Users\User\AppData\Local\Microsoft\WindowsApps\wsl.exe -l -v
Windows Subsystem for Linux has no installed distributions.
...
```
If Admin has installed distributions, mounting succeeds for Admin but disk is only visible in Admin's distributions.
**Versions**
```
>wsl --version
WSL version: 1.0.3.0
Kernel version: 5.15.79.1
WSLg version: 1.0.47
MSRDC version: 1.2.3575
Direct3D version: 1.606.4
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19045.2364
```
**Related/Duplicates**
#6147, #2979, #6414
Contributor guide
Research direction
Start by reviewing related issues #6147, #2979, and #6414, then trace how `wsl.exe --mount` resolves the elevated user's WSL distributions. Define the ownership and access behavior for mounting a drive into a restricted user's distribution, and verify it using the supplied restricted-user and administrator scenarios.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, linux
- Domain
- operating-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100