-
Notifications
You must be signed in to change notification settings - Fork 821
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
warning: Insecure world writable dir /mnt/c in PATH, mode 040777 #1426
Comments
@laktak Yeah, that's because /mnt/c is mounted with the umask=000. The actual Windows permissions there are not visible to the Linux-side, though they are enforced. Anyway, yes, it is a known issue that /mnt/c being mounted the way it is (and also other permissions on interop) do not make WSL secure as an actual server platform. For example, there is nothing stopping you, if you control a simple Linux user in a WSL instance, from dropping an executable in the startup folder that will then replace /etc/shadow the next time the Windows user logs in and out to give you root access. Even worse, you could actually overwrite /etc/shadow by dropping into cmd.exe and overwriting /etc/shadow from there. I'm sure the devs are aware of this, and that's why they definitely do not recommend running WSL as a server platform (also the disk i/o performance would be pretty atrocious for such a purpose). This will likely change in the future. |
Another way to put it is "why did you add an insecure path like The issues @fpqc mentions are not trivial, but they are mitigated by the ability to keep other people off one's machine or at least keep them from logging in to your own WSL subsystem. If you want to install executable files onto /mnt/c and use them, and you are reasonably sure no one else is likely to mess with files there, there's nothing to stop you. And of course, executables you install (with sudo) into /usr/local/bin are not flagged as insecure. We've already asked for the ability to install the WSL subsystem to a location other than our smallish ssd c: drives. I'm thinking that's what the issue is? Otherwise, why install things onto the mounted NTFS filesystem instead of putting them in /home or /usr/local/bin or /opt? |
@rodrymbo Because this is probably ruby executing scripts residing in a directory where he's doing interop between Windows and Linux tools. |
AFAIK this is the default - the Windows path is added by the system so you can launch Windows executables. |
Hey! Is there anyway to silence this error? Its messing up my pretty terminal :( </3. |
sudo chmod 755 /usr. You can read more in this post. |
This is happening to me too on Ubuntu 16.04.3 LST Xenial, didn't happen on previous (I think it was Trusty). Any ideas of how to silence this? #81 chmod doesn't seem to be working. |
I removed all windows path mentions from PATH to resolve this error by running: |
@gaurav-nelson and you just effectively killed your interop with Windows. Hope you don't use anything from there. If you do, might as well reinstall WSL now because it's alot less painful than trying to remap your paths from Windows. That being said, it may be easier to fix those particular issues thanks to 17063 and the introduction of |
Ref #2476 |
@DarthSpock yes I am not using it for any interop things. I always keep backup, So I do have a backup for PATH before I changed it. And I did this into another WSL instance (not my main one) |
Any news on this? |
@lucascaton: News on the way all the files in /mnt/ have the same owner and group (on the emulated/apparent Linux filesystem)? Or on the error message you get when you run a program that checks the PATH for world writable files? For the error message, standard Linux best practice is to set up your PATH for each script or environment. So if you are running a script that only needs access to As for whether There's also the recent workaround of setting up and mounting another, isolated WSL linux filesystem on which the emulation works pretty much as expected. The task there would be to unmount all the |
@rodrymbo WSL - Windows permission interop is in place, did you enable the metadata? Also recommend instead of mounting via DrvFS, using |
Just an FYI for others running into this problem and finding this closed issue... You can remove all those
If you add that line to your |
I was able to permanently squelch the pesky "insecure world writable dir /mnt/c" by adding the following text to /etc/wsl.conf: |
I had the same problem.
Alias this command line in bash profile for future:
so, everything is fine:
|
This one is in the squarely buried pile. It would be better if WSL behaved more like common Linux distros by default with respect to mounting external volumes. Something like [While there, a @dskoyer's post from February is a good work-around / interim-solution. |
there isn't way to undo this operations, is there? 🤦♂️ It messed up my paths. I can't open |
restarting solved it |
I ran into this issue to and solved it by writing up a vscode-server detector and path adder to my if [ -d $HOME/.vscode-server ]; then
# ensure there is only one thing to add to path
if [ `ls $HOME/.vscode-server/bin/*/bin | wc | awk '{print $1}'` == 1 ]; then
vscode_bin=`ls -d $HOME/.vscode-server/bin/*/bin`
#echo "detected vscode-server - adding to path: $vscode_bin"
PATH=$PATH:$vscode_bin
export PATH
fi
fi |
@dsloyer where is the /etc/wsl.conf file located? |
"wsl.conf is located in each Linux distribution in /etc/wsl.conf. If the file is not there, you can create it yourself. " @nrohankar29 https://docs.microsoft.com/en-us/windows/wsl/wsl-config#configure-per-distro-launch-settings-with-wslconf |
THEN REBOOT WINDOWS.....otherwise it does not work rightaway. |
or run |
I am unable to install jekyll due to this error while running : |
TL;DR: Inside the WSL terminal, use
If you rely on things installed from the Windows side or you use the windows filesystem to install things, this will break everything for you. This would be a good time to ask yourself why are you doing this. The WSL distros have a ext3 virtual disk which you can only manipulate properly if you have Hyper-V in the windows pro version, but it does the job. The contents of the file
If you want to go further and mount the (probably NTFS) underlying windows filesystems with the posix default umask - if you don't know what that is, you shouldn't do it:
To edit that file you must do it from inside the distro, for example with Reference: https://docs.microsoft.com/en-us/windows/wsl/wsl-config#configuration-settings-for-wslconf |
Thanks @iuriguilherme for your answer . It seems it is lot eaier to run jekyll on Linux (VM) then on WSL2. |
When I run Ruby gems I often see the warning
This is coming from Ruby, the shortest way to reproduce that I could find (though I'm no Ruby dev) is this:
Not sure how this should be handled - maybe Windows file permissions could be better mapped on the mounts.
OS Name: Microsoft Windows 10 Enterprise Insider Preview
OS Version: 10.0.14971 N/A Build 14971
The text was updated successfully, but these errors were encountered: