How To Mount Remote File Systems using SSHFS on Windows
SSHFS (SSH File System) is a command-line tool that uses SSH connections to establish local access to remote physical or virtual drives, simplifying remote file management.
This article explains how to use SSHFS to mount remote file systems on Windows.
Installation
To use SSHFS on Windows we need to install the following packages:
Introduce
WinFsp: This is a tool that allows developers and software engineers to to write their own file systems (Windows drives) as user mode programs and without Windows kernel programming knowledge. WinFsp is similar to FUSE (Filesystem in Userspace) for Linux and other UNIX-like systems.
SSHFS-Win: This is a port of SSHFS to Windows as we learned in the introduction SSHFS-Win uses Cygwin and WinFsp.
Once we’ve installed the WinFsp and SSHFS-Win packages we can proceed to use SSHFS to mount an external drive
Method 1: Adding an SSHFS Drive with Windows Explorer
To mount an SSHFS drive through Windows Explorer open Windows Explorer and right click This PC > Map network drive
After this a Windows dialog will appear, in this window we need to specify the Drive to mount to as well as the external SSHFS Folder. In order to do so we need the username, host, and remote directory to mount.
We may be asked to provide a password when connecting to the remote machine.
Once successfully mounted we’ll see the newly mounted drive in Windows Explorer.
So you have successfully added an SSHFS drive with windows explorer now you can use it
To unmount the disk, right-click the mounted device and select Disconnect:
Method 2: Adding an SSHFS Drive with PowerShell
In addition to mounting an SSHFS drive with Windows Explorer, we can use do so through a PowerShell terminal with the net use command.
net use [drive letter]: \\sshfs\[remote user]@[remote host][!port][\path]
For example:
net use Z: \\sshfs\[email protected]
The command does the following:
Z:
assigns the drive letter to the remote folder.[email protected]
is the remote user and host.
We may be asked to provide a password when connecting to the remote machine.
The output of the command informs of a successful connection.
To view the currently mounted disks through SSHFS, run:
net use
Confirming SSHFS drive mount with the ls command
ls [drive letter]:
For example:
ls Z:
Or right-click This PC to check.
If you you’d like to unmount the drive with net use you can use the following command along with the drive letter.
net use /del [drive letter]:
For example:
net use /del Z:
So you have successfully disconnected the drive.
Conclusion
This article has provided a detailed exploration of leveraging SSHFS on Windows systems. By harnessing the capabilities of SSHFS, users can experience the seamless and convenient mounting of remote drives from a variety of sources, including Windows, Linux machines…. Wish you success