Install an Ubuntu version from Microsoft Store.
- Ubuntu - Ubuntu (latest)
- Ubuntu 18.04 - Ubuntu 18.04
- Ubuntu 16.04 - Ubuntu 16.04
Please check out the Windows 10 Installation Guide written by Microsoft itself.
By default the file permissions are incorrectly handled when modifying a Windows file from WSL.
Solution: Mount windows partitions with metadata
mount option.
The WSL can do this by default with correct configuration.
Create /etc/wsl.conf
with the following content.
[automount]
enabled = true
root = /mnt/
options = "uid=1000,gid=1000,umask=22,fmask=11,metadata"
mountFsTab = true
[network]
generateHosts = true
generateResolvConf = true
[interop]
enabled = true
appendWindowsPath = true
Set correct permissions.
sudo chmod 0644 /etc/wsl.conf
Now restart the shell.
exit
In windows CMD, type:
bash.exe
Now you are in WSL again.
After that you should check out if it works.
$ mount -l
rootfs on / type lxfs (rw,noatime)
none on /dev type tmpfs (rw,noatime,mode=755)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
devpts on /dev/pts type devpts (rw,nosuid,noexec,noatime,gid=5,mode=620)
none on /run type tmpfs (rw,nosuid,noexec,noatime,mode=755)
none on /run/lock type tmpfs (rw,nosuid,nodev,noexec,noatime)
none on /run/shm type tmpfs (rw,nosuid,nodev,noatime)
none on /run/user type tmpfs (rw,nosuid,nodev,noexec,noatime,mode=755)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noatime)
C: on /mnt/c type drvfs (rw,noatime,uid=1000,gid=1000,umask=22,fmask=11,metadata,case=off)
Az utolsó sorban a "C:" sorában szerepelnie kell a "metadata" opciónak.
Related project: weasel-pageant
Download the binary archive weasel-pageant-1.1.zip
and extract it somewhere like C:/weasel-pageant/weasel-pageant
.
Run the following under WSL:
chmod +x /mnt/c/weasel-pageant/weasel-pageant
Add the following to your .bashrc
eval $(/mnt/c/weasel-pageant/weasel-pageant -r)
Run in WSL.
sudo echo "$USER ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/$USER
sudo chmod 0644 /etc/sudoers.d/$USER
Now you can run sudo
without typing the password.
- weasel-pageant
- Windows 10 Installation Guide
- WSL interoperability with Windows
- Chmod-Chown WSL Improvements
- Automatically Configuring WSL
- shakahl.com
- github.com/shakahl
MIT
Free Software, Hell Yeah!