Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mount a drive into WSL distro owned by a restricted user #9406

Open
pelepelin opened this issue Dec 27, 2022 · 8 comments
Open

Mount a drive into WSL distro owned by a restricted user #9406

pelepelin opened this issue Dec 27, 2022 · 8 comments
Labels

Comments

@pelepelin
Copy link

pelepelin commented Dec 27, 2022

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

@massmog
Copy link

massmog commented Jan 5, 2023

I can confirm this issue on my installation of WSL2 and Ubuntu.

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

Lsblk shows drive only in WSL of elevated user. Mounting is only possible if elevated user has WSL installed.

@meisenkaiser123
Copy link

meisenkaiser123 commented May 15, 2023

I can confirm same problem:

As Admin

PS D:\WSL\shared> wsl --version
WSL version: 1.2.5.0
Kernel version: 5.15.90.1
WSLg version: 1.0.51
MSRDC version: 1.2.3770
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19045.2846
PS D:\WSL\shared> wsl --mount .\PhysicalDrive2 --bare

Error message: (I dont understand)
This operation is only supported by WSL2.
Error code: Wsl/Service/AttachDisk/WSL_E_WSL2_NEEDED

as user:

PS D:\WSL\shared> wsl -l -v
NAME STATE VERSION

  • Ubuntu-18.04 Stopped 2
    CentOS Running 2
    EL8 Stopped 2
    PS D:\WSL\shared> wsl --mount \.\PhysicalDrive2 --bare
    Administrator access is needed to mount a disk.
    Error code: Wsl/Service/AttachDisk/WSL_E_ELEVATION_NEEDED_TO_MOUNT_DISK

    PS D:\WSL\shared>

@ramisedhom
Copy link

Same here:

> wsl -v
WSL version: 1.2.5.0
Kernel version: 5.15.90.1
WSLg version: 1.0.51
MSRDC version: 1.2.3770
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19044.2965

> wsl --mount \\.\PHYSICALDRIVE1
Administrator access is needed to mount a disk.
Error code: Wsl/Service/AttachDisk/WSL_E_ELEVATION_NEEDED_TO_MOUNT_DISK

@andrsmllr
Copy link

Same here.

wsl -v
WSL-version: 1.2.5.0
Kernel version: 5.15.90.1
WSLg version: 1.0.51
MSRDC version: 1.2.3770
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22000.1574

wsl --mount \.\PHYSICALDRIVE1
Administrator access is needed to mount a disk.
Error code: Wsl/Service/AttachDisk/WSL_E_ELEVATION_NEEDED_TO_MOUNT_DISK

@artarik
Copy link

artarik commented Nov 19, 2023

wsl 2 the same

PS C:\Users\user> wsl --mount \\.\PHYSICALDRIVE2
Administrator access is needed to mount a disk.
Error code: Wsl/Service/AttachDisk/WSL_E_ELEVATION_NEEDED_TO_MOUNT_DISK
PS C:\Users\user> wsl -v
WSL-version: 2.0.9.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19045.3693

@edumotya
Copy link

wsl 2.2.4.0 the same :(

PS C:\Users\Eduardo> wsl --mount \\.\PHYSICALDRIVE1 --bare
Administrator access is needed to mount a disk.
Error code: Wsl/Service/AttachDisk/WSL_E_ELEVATION_NEEDED_TO_MOUNT_DISK
PS C:\Users\Eduardo> wsl -v
WSL version: 2.2.4.0
Kernel version: 5.15.153.1-2
WSLg version: 1.0.61
MSRDC version: 1.2.5326
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26091.1-240325-1447.ge-release
Windows version: 10.0.19045.4529

@xR3b0rn
Copy link

xR3b0rn commented Jul 23, 2024

No solution to this problem?

@mikegerber
Copy link

Same problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants