Skip to content

How to mount a remote file system with sshfs

Introduction

sshfs is a client software that mounts a remote filesystem using an ssh connection. Any server that allows ssh connections can be mounted, and no additional server-side software or services are needed.

The following guide describes how to install sshfs on your client machine and how to mount a remote filesystem.

This help page provides more technical details.

Installing the client software

Ubuntu/Linux

You can install sshfs and its dependencies with the normal package manager.

sudo apt-get install sshfs

MacOS

Download then install both of the osxfuse and sshfs stable releases from this page.

Windows

Follow either of these installation instructions: win-sshfs or sshfs-win

Mounting a remote filesystem

For this example, we will mount the ScienceCluster filesystem from a ScienceCloud (Ubuntu) instance.

First, create the local folder which is the mountpoint

mkdir -p ~/mnt_cluster

Then, run the sshfs command:

sshfs $USER@cluster.s3it.uzh.ch: ~/mnt_cluster

To follow symlinks, which on the ScienceCluster includes at least the $HOME/data/ and $HOME/scratch/ folders, add the -o follow_symlinks flag:

sshfs -o follow_symlinks $USER@cluster.s3it.uzh.ch: ~/mnt_cluster

Auto-mount on startup

There are several options.

  1. Add a record to /etc/fstab. Requires authentication with ssh keys. Read more.

  2. Install and enable autofs. Read more.

Unmounting

To unmount, run

umount ~/mnt_cluster

Last update: October 14, 2021