Why default WSL2 installation ignoring Linux permissions in filesystem? #13503
Replies: 1 comment 1 reply
-
💡 Why WSL2 Ignores Linux Permissions by Default (and What to Do About It) You’re absolutely right — file permissions are a core part of Linux, and when working with Docker or development workflows, having everything default to -rwxrwxrwx is both insecure and frustrating. ⚙️ Why This Happens by Default By default, WSL mounts the Windows filesystem (NTFS) under /mnt/c, /mnt/d, etc. NTFS doesn’t store traditional Linux permissions (UID, GID, chmod bits). To avoid breaking compatibility, WSL just exposes files as full-access (777) so both Windows and Linux tools can use them. The assumption was: most WSL users interact with their Windows files, not pure Linux development, so Microsoft chose usability over strict POSIX correctness. 🛠️ How to Enable Real Permissions As you discovered, you can enable metadata support by configuring /etc/wsl.conf: Then restart WSL with: Now, Linux-style permissions (chmod, chown, etc.) will persist on NTFS-mounted files. 🔒 Why It’s Not Default (Yet) Compatibility & Stability: Many Windows apps break if strict permissions are applied (e.g., editors not able to write files). Performance: Metadata emulation introduces overhead compared to the simple “everything is writable” mode. User Base: A large portion of WSL users are beginners who might find strict permissions confusing. 📌 Current Status & Future Plans There’s no official confirmation from Microsoft about making metadata the default. However, advanced users are encouraged to enable it manually via wsl.conf. For projects requiring strict permissions (like Docker builds), it’s considered a best practice to enable metadata from the start. ✅ In short: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
This is really frustrated that default configuration in WSL ignoring linux permissions and everything become
-rwxrwxrwx
. Which connecting with docker build make all files with wrong permissions inside docker (huge risk from security point of view).It took me a lot of time to understand that
/etc/wsl.conf
needs be modified withmetadata
to allow have proper linux permissions. Why this is not default? Goal of WSL is running Linux subsystem and file permissions are one the most important configuration when working with linux?Any plans to make this
enabled
by default?Beta Was this translation helpful? Give feedback.
All reactions