How to mount a remote folder over SSH with sshfs

Install sshfs, create an empty folder, and run sshfs user@server:/path ~/mnt/server. The remote folder then behaves like a local one. To unmount it, run fusermount3 -u ~/mnt/server on Linux or umount ~/mnt/server on macOS. The server only needs normal SSH with SFTP enabled. On a Mac, sshfs needs macFUSE first.

Updated . SSHFS 3.7.3 with FUSE 3.17.2 as root on Debian 13 in a privileged throwaway container, against OpenSSH 10.0 in another.

Mount and unmount on Linux

sudo apt install sshfs
mkdir -p ~/mnt/server
sshfs user@server:/var/www ~/mnt/server

Now ls ~/mnt/server shows the folder on the server, and files you write there are written on the server. A path without a leading slash, as in server:project, starts from your home folder there. On Fedora the package is called fuse-sshfs.

fusermount3 -u ~/mnt/server

On older systems the command can be fusermount without the 3. If you are inside the folder or a program has a file open, it fails with Device or resource busy. Leave the folder and try again.

Your usual keys, ~/.ssh/config entries and port options work:

sshfs server:project ~/mnt/server
sshfs -p 2222 user@server:/srv ~/mnt/server
sshfs -o IdentityFile=~/.ssh/id_work user@server:/srv ~/mnt/server

Useful options

OptionWhat it does
-o reconnectReconnects after a dropped connection
-o ServerAliveInterval=15,ServerAliveCountMax=3Notices a dead connection, instead of hanging
-o roMounts read-only
-o idmap=userShows the remote user's files as yours
-o follow_symlinksFollows symlinks on the server
-o allow_otherLets other local users see the mount

A practical everyday command:

sshfs -o reconnect,ServerAliveInterval=15,ServerAliveCountMax=3 user@server:/srv ~/mnt/server

allow_other as an ordinary user fails with this message until you add user_allow_other to /etc/fuse.conf:

fusermount3: option allow_other only allowed if 'user_allow_other' is set in /etc/fuse.conf

When the connection breaks

We killed the session on the server in three setups:

SetupResult
Plain mount, session killedsshfs ended and the folder was empty again, with no mount
-o reconnect, session killedThe next ls worked over a new connection
sshfs process killed with kill -9ls: cannot access ...: Transport endpoint is not connected

In the last case fusermount3 -u ~/mnt/server cleans it up, and you can mount again.

With reconnect, a login that needs a typed password cannot reconnect by itself, so use a key without a prompt or an agent.

Common surprises

  • The local folder's contents disappear from view. sshfs mounted over a folder holding a file in our test, and hid that file until the unmount. Use an empty folder.
  • Files show a different owner. Without idmap=user, numeric owners from the server are shown as they are, such as 1000. In our test with idmap=user, they appeared as the local user.
  • It is not a local disk. Every read and write goes over the network. Tools that walk many files, such as git status or a code indexer, can be slow.
  • The path must exist. A wrong path fails right away with server:nosuch: No such file or directory.

macOS: macFUSE

macFUSE adds FUSE support, and it does not include file systems by itself. Its site offers an SSHFS package as a separate download. Install macFUSE first, then SSHFS.

macFUSE has two backends. The kernel extension is the default, and on Apple silicon it needs a restart into Recovery the first time, to allow third party extensions. According to the macFUSE documentation, the FSKit backend on macOS 26 runs without that change: add the mount option -o backend=fskit. Unmount with:

umount ~/mnt/server

Project status

The SSHFS README says it has no active regular contributors, and that its maintainer applies pull requests and makes releases but fixes only high-impact issues. It works, as our test shows, but keep this in mind for anything critical. For regular transfers, rsync is often a better fit.

To choose between the tools, see scp vs sftp vs rsync.

Questions

Does sshfs need anything on the server?

Only a normal SSH server with SFTP enabled. If sftp fails with subsystem request failed, see that error's guide.

Why is sshfs slow?

Every read and write goes over the network. Tools that walk many files, such as git status or a code indexer, feel it most. Copy files with rsync when you need speed.

How do I fix Transport endpoint is not connected?

The sshfs process died and left the mount behind. Run fusermount3 -u on the folder, or umount on macOS, then mount again. Add -o reconnect to recover from dropped connections.

Sources

More in SFTP and file transfer

All guides