Skip to content

Instantly share code, notes, and snippets.

@vini2003
Last active November 24, 2021 17:33
Show Gist options
  • Select an option

  • Save vini2003/4369cf57e814f25cb8c3b1385b68b047 to your computer and use it in GitHub Desktop.

Select an option

Save vini2003/4369cf57e814f25cb8c3b1385b68b047 to your computer and use it in GitHub Desktop.
Mounting a remote Linux file system in Windows with key authorization

This is not a complete guide; merely the main steps I followed.

  1. Install sshfs (SSH File System) in your Linux host.
  • apt install sshfs
  1. Enable Windows Subsystem for Linux (WSL) in your Windows client.
  1. Install Ubuntu from the Windows Store.
  1. Update your WSL installation to WSL 2.
  • wsl --set-default-version 2
  1. Copy your SSH keys from the Windows client to WSL.
  • cp -r /mnt/c/Users/<username>/.ssh ~/.ssh
  1. Add an sshfs entry to fstab.
  • sshfs#<user>@<host>:<directory> <local directory> fuse allow_other,identityfile=/home/<user>/.ssh/id_rsa,defaults 0 0
  1. Mount your new entry.
  • sudo mount -a

  • If errors appear, add the debug option before or after allow_other.

  1. Open Explorer and go to \\wsl$\Ubuntu-20.04\.

  2. Browse to your mounting directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment