Log inSign up

Use a remote server folder as if it were local with SSHFS

Install sshfs on the machine that should see the files, create an empty folder and run sshfs deploy@198.51.100.24:/srv/data ~/vps-data -o reconnect. The remote folder then behaves like a local directory for editors and file managers; fusermount3 -u ~/vps-data unmounts it. Only SSH is needed on the server.

Topic: File transfer and archives · Tested on: Ubuntu 24.04 and 22.04, Debian 12 and 13, Rocky Linux 9, AlmaLinux 9 · Updated 2026-12-03

What is SSHFS good for?

SSHFS mounts a remote directory through FUSE using the SFTP protocol, so any program can open, edit and save files on the server as if they were on your disk. It is handy for editing a site with a desktop editor, browsing logs with familiar tools, or letting one server read files from another without setting up NFS or Samba.

It is not a high performance network file system. Every operation is a round trip over SSH, so large directory scans feel slow on distant links, and it is a poor home for databases or anything that needs reliable file locking. For bulk copies, rsync is much faster; for one-off transfers, sftp is simpler.

What has to be in place on the server?

Nothing beyond a working SSH login. The SFTP subsystem that SSHFS uses is enabled in OpenSSH on all our Linux images, and no extra firewall port is involved. Set up key authentication first (see SSH keys and hardening), since automatic mounts cannot answer password prompts. If you want to limit a mount user to one folder, create an SFTP-only account as shown in SFTP-only users; SSHFS works with those accounts.

How do I install SSHFS on the client?

The client is the machine that mounts the folder: your Linux desktop, or a second server.

# Ubuntu 24.04 / 22.04, Debian 12 / 13
sudo apt update
sudo apt install sshfs

# Rocky Linux 9, AlmaLinux 9 (from EPEL)
sudo dnf install epel-release
sudo dnf install fuse-sshfs

sshfs --version

On macOS, install macFUSE and the matching SSHFS build; on Windows, SSHFS-Win maps a remote folder to a drive letter. Their options differ slightly, but the remote address format is the same.

How do I mount and unmount a remote folder?

Create an empty mount point you own, mount, work, then unmount.

mkdir -p ~/vps-data
sshfs deploy@198.51.100.24:/srv/data ~/vps-data \
  -o reconnect,ServerAliveInterval=15,ServerAliveCountMax=3

df -h ~/vps-data
ls -la ~/vps-data

fusermount3 -u ~/vps-data

Leaving out the path after the colon mounts the remote home directory. reconnect plus the keepalive options let the mount recover after a short network drop instead of hanging. If SSH runs on another port or needs a particular key, pass -p 2222 and -o IdentityFile=~/.ssh/deploy_ed25519, or simply use a host alias from ~/.ssh/config such as sshfs vps:/srv/data ~/vps-data. On systems with the older FUSE 2 tools the unmount command is fusermount -u; root can always use umount.

Why do files show the wrong owner, and how do I fix it?

SSHFS shows the numeric owner IDs from the server, which may belong to a different user on your machine. Add idmap=user so files owned by the remote login user appear as yours:

sshfs vps:/srv/data ~/vps-data -o reconnect,idmap=user

Remember that the actual permission checks happen on the server: you can only change what the remote deploy user may change. To let other local users (for example a web server process) see the mount, enable user_allow_other in /etc/fuse.conf and add -o allow_other,default_permissions; the second option makes the kernel apply the displayed permissions instead of trusting everyone.

How do I mount it automatically at boot?

Add an /etc/fstab line that uses systemd automount, so the folder mounts on first access and boot never waits for the network.

sudo mkdir -p /mnt/vps-data
sudo ssh -i /root/.ssh/sshfs_ed25519 deploy@198.51.100.24 true   # accept the host key once

# /etc/fstab (one line)
deploy@198.51.100.24:/srv/data /mnt/vps-data fuse.sshfs noauto,x-systemd.automount,_netdev,reconnect,ServerAliveInterval=15,IdentityFile=/root/.ssh/sshfs_ed25519,allow_other,default_permissions,uid=1000,gid=1000 0 0
sudo systemctl daemon-reload
sudo systemctl restart remote-fs.target
ls /mnt/vps-data
systemctl status mnt-vps\x2ddata.automount

The mount is made by root, so the key must be root-readable and the host key must already be in root's known_hosts, which the first command takes care of. uid and gid make the files appear owned by your local user (find yours with id). Test with sudo mount /mnt/vps-data before rebooting; a broken fstab line is easier to fix while you are still logged in.

How can I make SSHFS faster?

Latency matters more than bandwidth, so mount from a server in a nearby city when you can (see our cities). A few options also help:

sshfs vps:/srv/data ~/vps-data \
  -o reconnect,idmap=user,kernel_cache,max_conns=4 \
  -o Compression=no

kernel_cache lets the local kernel cache file contents, which is safe when only you change the files. max_conns (SSHFS 3.7 and newer) opens several SSH connections in parallel. Compression helps only on slow links with text data. For moving many gigabytes, step out of the mount and use rsync directly.

How do I check that the mount is healthy?

Look for it in the mount table, write a test file and confirm it on the server.

findmnt -t fuse.sshfs
echo ok > ~/vps-data/.mount-test
ssh vps cat /srv/data/.mount-test
rm ~/vps-data/.mount-test

Reading and writing through the mount counts as transfer on the server just like any other SSH traffic.

What are common SSHFS problems?

  • Transport endpoint is not connected: the connection dropped without reconnect. Unmount with fusermount3 -uz ~/vps-data and mount again with the keepalive options.
  • read: Connection reset by peer: the SSH login itself fails. Test ssh -v vps, which shows the real reason.
  • fuse: device not found: load the module with sudo modprobe fuse.
  • Permission denied for other local users: add allow_other and enable it in /etc/fuse.conf.
  • A shell hangs when the server is offline: use the automount setup, which times out instead of blocking.

Questions about Mount remote folders with SSHFS

Does SSHFS need anything installed on the server?

Only the OpenSSH server with SFTP enabled, which is the default on every Linux image we provide.

Can I mount a folder from one VPS on another VPS?

Yes. Install sshfs on the server that mounts, create a key for it and mount as shown. Keep both in nearby cities for better response times.

Is SSHFS encrypted?

Yes. All traffic runs inside the SSH connection, with the same encryption and key checks as a normal login.

Should I run a database or Docker volume on SSHFS?

No. Locking and latency make that unreliable. Keep databases on the local disk and copy dumps across with rsync or Borg.

How do I unmount when the mount is stuck?

Use a lazy unmount: fusermount3 -uz /path, or sudo umount -l /path as root.