Skip to content

Instantly share code, notes, and snippets.

@Madse
Forked from sgtoj/persistent_c_mount_wsl.sh
Created April 18, 2021 14:05
Show Gist options
  • Save Madse/a9025be2bd2d5bda5f7d1ccaf50c27e3 to your computer and use it in GitHub Desktop.
Save Madse/a9025be2bd2d5bda5f7d1ccaf50c27e3 to your computer and use it in GitHub Desktop.
Ubuntu for Windows: Mounting C: Drive to WSL's Root
# allow `mount` cmd without password
echo "$USER ALL=NOPASSWD: /bin/mount" | (sudo su -c 'EDITOR="tee -a" visudo')
# add the mount directive to `fstab`
sudo mkdir -p /c
sudo sh -c "echo '/mnt/c /c none bind' >> /etc/fstab"
# update to `.bashrc` to auto mount at login
echo "sudo mount -a" >> ~/.bashrc
# now reload it
source ~/.bashrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment