How to mount remote filesystem over ssh (both Windows & Linux)
-
You can mount the filesystem of another server over SSH (using SFTP) both on linux and windows with sshfs (SSH File System).
On the Windows client you have to install:
- WinSfp - https://github.com/billziss-gh/winfsp/releases
- SSHFS-Win https://github.com/billziss-gh/sshfs-win/releases
To mount the server just map the network drive in the file explorer or with
net use
or whatever.
Mount the root directory with\\sshfs.r\user@host
On the linux client you mount it with the
sshfs
command.
Syntax:sshfs [user@]hostname:[directory] mountpoint
More on https://github.com/libfuse/sshfsThought I'll share since I did this today and thought it might be useful for others as well.
-
On Windows using Chocolatey.
choco install sshfs
choco install winfsp
-
This seems to work rather well... Wish I'd known about this a few months ago, lol!
Anyhow, one thing I'm trying to figure out how to work out how to specify the folder I want to mount.
IE: /var/www
... Any ideas?
-
@dafyre said in How to mount remote filesystem over ssh (both Windows & Linux):
This seems to work rather well... Wish I'd known about this a few months ago, lol!
Anyhow, one thing I'm trying to figure out how to work out how to specify the folder I want to mount.
IE: /var/www
... Any ideas?
Using
sshfs.r
instead ofsshfs
should show the host root directory. -
@dafyre Installing sshfs and winfsp via choco is older than the ones from GitHub.
If you installed them via choco do this to mount at the host root directory or other directories.
https://github.com/billziss-gh/sshfs-win/issues/102Host root directory
\\sshfs\remoteuser@host\..\..
Specific directory like /var/www
\\sshfs\remoteuser@host\..\..\var\www
-
@black3dynamite said in How to mount remote filesystem over ssh (both Windows & Linux):
@dafyre Installing sshfs and winfsp via choco is older than the ones from GitHub.
If you installed them via choco do this to mount at the host root directory or other directories.
https://github.com/billziss-gh/sshfs-win/issues/102Host root directory
\\sshfs\remoteuser@host\..\..
Specific directory like /var/www
\\sshfs\remoteuser@host\..\..\var\www
Thanks for the pointer. I did install using choco. I'm able to make it work now.
Edit: Just to see if I can, I may go back and do straight installs.
-
@dafyre said in How to mount remote filesystem over ssh (both Windows & Linux):
@black3dynamite said in How to mount remote filesystem over ssh (both Windows & Linux):
@dafyre Installing sshfs and winfsp via choco is older than the ones from GitHub.
If you installed them via choco do this to mount at the host root directory or other directories.
https://github.com/billziss-gh/sshfs-win/issues/102Host root directory
\\sshfs\remoteuser@host\..\..
Specific directory like /var/www
\\sshfs\remoteuser@host\..\..\var\www
Thanks for the pointer. I did install using choco. I'm able to make it work now.
Edit: Just to see if I can, I may go back and do straight installs.
As I said above with the latest version I mount the root directory with
\\sshfs.r\user@host
However, if you want to mount another directory like
/var/www
you have to do:
\\sshfs.r\user@host\var\www\
The trailing \ is very important!
It just doesn't work without it if your path is more than one directory deep. You also need to use backslash and not the forward slash.