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

Permission masks are ignored for new directories/files in DrvFs filesystem with WSL2 Ubuntu 20.04 (but work fine with WSL2 Ubuntu 18.04) #5733

Closed
ailiop opened this issue Aug 7, 2020 · 2 comments

Comments

@ailiop
Copy link

ailiop commented Aug 7, 2020

Environment

Windows build number: 10.0.19041.388
Your Distribution version: Ubuntu 20.04.1 LTS
Linux version 4.19.104-microsoft-standard
WSL 2

Steps to reproduce

$ cd /mnt/d
$ mkdir foo
$ touch bar
$ ls -l
[...]
-rwxrwxrwx 1 ailiop ailiop   0 Aug  7 13:21  bar
drwxrwxrwx 1 ailiop ailiop 512 Aug  7 13:21  foo
$ umask
0022

$ cat /etc/wsl.conf
[automount]
enabled = true
root = /mnt/
options = "metadata,umask=22,fmask=11"
mountFsTab = false

[network]
generateHosts = true
generateResolvConf = true

Expected behavior

Permissions for directories and files created via WSL2 Ubuntu 20.04 should be set by default according to the umask and fmask settings in /etc/wsl.conf.

In the above example, the ls -l command should yield:

$ ls -l
-rw-r--r-- 1 ailiop ailiop   0 Aug  7 13:27  bar
drwxr-xr-x 1 ailiop ailiop 512 Aug  7 13:27  foo

Actual behavior

Directories and files that are created via WSL2 Ubuntu 20.04 in DrvFs-automounted drives always have all permissions set (777 / rwx).

(However, directories and files that are created in the WSL2 Ubuntu 20.04 filesystem, e.g. under ~/, have the expected Linux-default permissions.)

Additional info

This issue does not affect WSL2 Ubuntu 18.04

Surprisingly, if I try the same steps as above (see Steps to reproduce) in WSL2 Ubuntu 18.04, everything works as expected. That is, bar and foo in the example are created with permissions 755 and 744, respectively.

Relevant distribution version: Ubuntu 18.04.5 LTS

Installed WSL2 distributions

PowerShell output:

> wsl --list --all --verbose
  NAME            STATE           VERSION
* Ubuntu-18.04    Running         2
  Ubuntu          Running         2

Setting umask in ~/.bashrc does not help

I saw #352 and tried setting umask in my ~/.bashrc, but nothing changed. (Plus, that would not explain why things work as expected with WSL2 Ubuntu 18.04.)

@therealkenc
Copy link
Collaborator

Cannot repro perceived 18.04 vs 20.04 difference here. WAG no wsl.exe --shutdown to make your wsl.conf changes take.

image

@ailiop
Copy link
Author

ailiop commented Aug 7, 2020

Alright, this is embarrassing: I was sure I had actually rebooted since editing /etc/wsl.conf, but apparently I was wrong...

Shutting down WSL fixed my issue. Thank you and sorry for the unnecessary post.

@ailiop ailiop closed this as completed Aug 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants