microsoft / microsoft/WSL

sudo has no effect on native Windows executables

Open
#10,448 2 comments 0 reactions 0 assignees View on GitHub
feature
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

### Windows Version

Microsoft Windows [Version 10.0.19045.3324]

### WSL Version

1.2.5.0

### Are you using WSL 1 or WSL 2?

- [X] WSL 2
- [ ] WSL 1

### Kernel Version

5.15.90.1

### Distro Version

Debian 12

### Other Software

_No response_

### Repro Steps

1. Install a fresh Debian instance:
```
wsl --install -d debian
```
2. Create default user (its name does not matter, let's take `admin`).
3. From WSL terminal, open Windows Notepad as `root`:
```
sudo -u root $(command -v notepad.exe)
```
4. Within Notepad GUI, type some random text and save it to a new file (for example, `test.txt`) located at `\\wsl$\debian\home\admin\`.
5. Close the Notepad window.
6. Again from WSL terminal, check the owner of the newly-created file:
```
$ ls -l ~/test.txt
```

### Expected Behavior

```
-rw-r--r-- 1 root root 9 Sep 4 19:52 /home/admin/test.txt
```

### Actual Behavior

```
-rw-r--r-- 1 admin admin 9 Sep 4 19:52 /home/admin/test.txt
```

### Diagnostic Logs

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the WSL 2 Debian scenario with `sudo -u root $(command -v notepad.exe)` and the `\\wsl$\debian\home\admin\` path. Investigate how native Windows executables launched from WSL handle file ownership; done means the reproduced file ownership matches the expected root-owned result.

Written by the indexing model from the issue text.

Assessment

Tech stack
debian
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.