This article address some common problems/caveats when using WSL as your daily development environment.
Access Windows File under WSL
WSL use a plugin called DrvFs to mount Windows drive
Auto-mount all Windows drive to,
/mnt/ for example
For more detailed explanation: https://blogs.msdn.microsoft.com/wsl/2016/06/15/wsl-file-system-support/
Access Linux File under Windows
DO NOT, under ANY circumstances, create and/or modify Linux files using Windows apps, tools, scripts, consoles, etc.
Also note: Opening files using some Windows tools may read-lock the opened files and/or folders, preventing updates to file contents and/or metadata, essentially resulting in corrupted files/folders.
Share Windows file to WSL
The easiest and most convenience way is to share Windows file to WSL, for Example: Create a folder in
The folder will be visible in WSL as
ln -s /mnt/c/var/www /var/www
Fix Permission under DrvFs always being 0777
Since Build 17063, WSL includes an improvement that handles permissions under DrvFs (i.e. Windows drive) properly.
But did not enable it by default.
/etc/wsl.conf and add this content to enable
metadata mount option by default.
options = "metadata"
PHPStorm Bash Integration
Settings > Tools > Terminal
PHPStorm NPM Integration
PHPStorm 2018.2 and above support triggering Node.JS from WSL
Settings > Languages and Frameworks > Node.JS and NPM
Node Interpreter: Add WSL > Linux Distro: Ubuntu 18.04, Path:
Git Repository Line Ending Problem
If you checkout a Git repository in Windows, some files end in
\r\n may cause problem (Especially .sh files)
If you’re on a Linux or Mac system that uses LF line endings, then you don’t want Git to automatically convert them when you check out files; however, if a file with CRLF endings accidentally gets introduced, then you may want Git to fix it. You can tell Git to convert CRLF to LF on commit but not the other way around by setting core.autocrlf to input:
Run this in WSL and checkout your repository using Git in WSL again.
git config --global core.autocrlf input
Git Repository Permission Problem
Another problem, if you checkout a repository in WSL, your IDE/git in Windows may always considered files as changed (Permission changed)
Run this in Windows side to make Git ignore permission change.
(First line remove default true for working copy, Second line set false for Windows side)
git config --unset core.filemode
git config --global core.filemode false
Apache H00076: Failed to enable APR_TCP_DEFER_ACCEPT
Although it does not harm anything, add this two lines to
AcceptFilter https none
AcceptFilter http none
Blue Color too dark on WSL bash
My personal favorite theme makes WSL bash looks similar to native Ubuntu bash terminal.
SSHd – Could not load host key: /etc/ssh/ssh_host_rsa_key
sudo killall sshd
sudo ssh-keygen -A
sudo /etc/init.d/ssh start