File permission in Windows Subsystem for Linux

Created: 2019-12-30   Category: windows   Print this articleBack to Home

This post was originally from here. Windows Subsystem for Linux (WSL) usually mounts Windows drives under /mnt. However, the Linux file permission seems to be awful. To fix this issue, simply add to /etc/wsl.conf (if the file does not exist, simply create it):

[automount]
enabled = true
options = "metadata,umask=22,fmask=11"

In short, every files now have permission 0644 and every directories have permission 0755.

Also, add the following to ~/.profile to fix the permission of newly created files and directories.

if [[ "$(umask)" = "0000" ]]; then
	umask 0022
fi

Valid CSS! Valid HTML 4.01 Transitional Back to Top
Powered by Jekyll
The content on this site is shared under a CC BY-SA 4.0 license, unless otherwise noted