The Windows Linux Subsystem (WSL) comes with /win/c
mounted world read-write and is setup for compatibility between windows and linux by putting all your windows paths into your linux system path. This is great for some usecases. Some tools get grumpy having these world writable directories a users path. While this doesn't break them but it can cause annoying warning messages.
On the other hand, when you don't care about the windows tools being in your path, it might make you more sane not to see those error messages, and also to limit the number of places tools look for supporting binaries not-relevant to themselves.
: warning: Insecure world writable dir /mnt/c in PATH, mode 040777
You can remove all those /mnt/c
paths from your $PATH
with the following line:
export PATH=`echo $PATH | tr ':' '\n' | awk '($0!~/mnt\/c/) {print} ' | tr '\n' ':'`
If you add that line to your .bashrc
file it will automatically be run ... do that only if you are sure you don't want those windows bin dirs in your path. You can always remove the line to bring them back.
I've setup a ~/.bash.d/remove_win_path
that checks for a /.keep_win_path
file and if not found it cleans out any /mnt/c
related entries from my PATH. I can temporarly overrride that behaivor for a shell by setting a environment variable KEEP_WIN_PATH=1
No need to update
PATH
.Just add this line into
/etc/wsl.conf
Extra:
If you need specific ENV from windows side, such as like VScode, explorer.exe etc..