AmmarRahman/wsl-vpn

Permission denied error when running setup

gideoncresswell opened this issue · 3 comments

On my WSL2 instance, I am running sudo ./wsl-vpnkit-setup.sh and immediately after I enter my WSL password I get the following error

cp: cannot create regular file '/mnt/c/bin/wsl-vpnkit.exe': Permission denied

The script needs to copy the files somewhere, and the default is C:\bin on your windows host.

Does C:\bin already exist on the windows host for some other purpose, by any chance?

It did exist - I believe from a failed install of this. It was deleted when I ran the wsl-vpnket-unsetup.sh script.

However, now I get
mkdir: cannot create directory '/mnt/c/bin': Permission denied although I am running as sudo.

I'm not sure why you are having trouble with that path, it's a little non-standard to use the C:\ like that, but it's been working for use so far.

The path is in two locations in the code:
https://github.com/AmmarRahman/wsl-vpn/blob/main/common.env#L6
https://github.com/AmmarRahman/wsl-vpn/blob/main/wsl-vpnkit-start.sh#L3

Since we are creating a directory in the "windows" area of the hard drive, it's hard to predict what your company has done to permissions there.

You could try changing the path to something more traditional, say:
C:\Users\{your username here}\wslvpn and see if that works any better?