Getting `sshfs` working on WSL or finding an alternative
Solution 1
Since I asked this question, Microsoft has released WSL 2 in its Insiders Preview ring. Since this provides a full Linux kernel to WSL, no more workarounds are necessary to get SSHFS to work.
Update: WSL 2 is now publicly available as of Windows version 2004. Have fun!
Solution 2
So I have a workaround that you might like. I installed SFTP Net Drive 2017 and then remotely connected to the file system I wanted. I mapped it (via the GUI) as R:\
. From WSL, you can then map R:\
to a local folder as explained here.
So in WSL, I have a folder in my home directory called cluster
. To mount it to be my local home from my cluster, I run:
sudo mount -t drvfs R: ~/cluster
and to unmount it, I run
umount ~/cluster
for convenience, I made an alias called mc
, sourced it from my .bashrc
alias mc="sudo umount ~/cluster; sudo mount -t drvfs R: ~/cluster"
I hope this helps!
Related videos on Youtube
![Isaac Corbrey](https://lh6.googleusercontent.com/-1Kb-R2cJvrw/AAAAAAAAAAI/AAAAAAAAANw/r4-3MvHL56I/photo.jpg?sz=256)
Isaac Corbrey
Updated on September 18, 2022Comments
-
Isaac Corbrey almost 2 years
My university's CS department has its own server used for development (from here on out,
dev.univ.edu
). I have SSH and SFTP access to this server, and I was hoping to do some heavy work on my Windows laptop using WSL. My plan was to usesshfs
to mount the server's filesystem on my laptop via SFTP, so that I could use my own tools instead of having to use the limited programs on our server. However, whenever I try usingsshfs
, the following happens:user@host:~$ sshfs -p 22 [email protected]: ~/dev/ -o follow_symlinks > fuse: device not found, try 'modprobe fuse' first
Running
modprobe fuse
gives me the following result:modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.4.0-43-Microsoft/modules.dep.bin' modprobe: FATAL: Module fuse not found in directory /lib/modules/4.4.0-43-Microsoft
After some digging, it seems that
fuse
is not supported on WSL, even after the UserVoice page forfuse
support has been up for over 2 years with over 1500 people asking for it. Sincesshfs
relies onfuse
(I assume for creating the filesystem that the remote files sit in), this renderssshfs
unusable.I have found a project (
billziss-gh/winfsp
) that seems promising, but I have no idea how to implement it in combination withsshfs
. Is there someone more knowledgeable than I am that can help me get this working?EDIT: According to this issue,
winfsp
will not work with WSL. However, I noticed a project by the same guy (billziss-gh/nfs-win
) that might be useful.-
lijat over 5 yearsUntil a good sshfs filesystem implementation has been created for window have you considered using git? creat repo on server, clone to desktop over ssh and push changes back to the server as you make them.
-
-
Stabledog over 4 yearsAre you still using this approach? Do you have any problems with file permissions or data coherence?
-
Leo almost 4 yearsHow do permissions work?
-
GiM over 3 yearsThere's problem with sshfs and fuse. See issue page: github.com/microsoft/WSL2-Linux-Kernel/issues/58
-
Paolo Squadrito over 3 yearsWhat is gonna happen when the system restart?(or WSL restart for some reason) do you have to mount again the folder manually?