Skip to main content
How To Mount Remote File Systems Over SSH using SSHFS - Virtarix Blog

How To Mount Remote File Systems Over SSH using SSHFS

January 27, 2026 · Blog / Technical Guides

Working with files on remote servers often means constantly uploading, downloading, or switching between terminals. SSHFS simplifies remote file access by mounting remote directories locally over your existing SSH connection. You can edit files, move things around, and work just like you would with any local folder. No additional server setup required. If you can SSH into a machine, you can mount its filesystem.

This guide works with any server that has SSH access. Whether you are using Virtarix VPS hosting or another provider, the commands and configurations remain the same across all modern Linux distributions.

What is SSHFS?

SSHFS is a filesystem client that mounts remote directories over SSH using FUSE (Filesystem in Userspace). It works through your existing SSH connection using the SFTP protocol, which most servers have enabled by default.

The current stable version is 3.7.3. All major Linux distributions ship this version in their repositories. No server-side installation or additional ports required.

Prerequisites

Before you start, you need:

  • SSH access to your remote server (ssh user@remote.host should work)
  • Local mount point: Create with mkdir ~/remote_mount
  • FUSE 3: Included in all modern Linux distributions

Run SSHFS as a regular user, not root. Root usage causes permission and security issues. Only use sudo for editing system files like /etc/fstab.

For automation, use SSH key authentication with ssh-keygen -t ed25519 and ssh-copy-id user@remote.host.

Installation

Ubuntu 24.04 LTS

Install SSHFS on Ubuntu
sudo apt update && sudo apt install sshfs -y

Debian 13 (Trixie)

Debian 13 is the current stable release.

Install SSHFS on Debian
sudo apt update && sudo apt install sshfs -y

Fedora 43 and later

Current release: Fedora 43. Use the same command for newer versions.

Install SSHFS on Fedora
sudo dnf install fuse-sshfs -y

Note that Fedora uses the package name fuse-sshfs.

Arch Linux

Install SSHFS on Arch Linux
sudo pacman -S sshfs

All installations include SSHFS 3.7.3 with FUSE 3 dependencies.

Basic mount

Mount syntax:

Mount a remote directory with SSHFS
sshfs user@remote.host:/remote/path ~/remote_mount

Replace user with your username, remote.host with the server address, and /remote/path with the target directory. Access mounted files at ~/remote_mount.

Files appear with your remote SSH user's permissions.

IPv6: Wrap addresses in brackets like sshfs user@[2001:db8::1]:/path ~/mount.

First connection: Verify the host fingerprint prompt against your server's actual fingerprint to prevent man-in-the-middle attacks.

Unmounting

Unmount with:

Unmount an SSHFS filesystem
fusermount3 -u ~/remote_mount  # FUSE 3 (modern systems)
fusermount -u ~/remote_mount   # FUSE 2 (older systems)
umount ~/remote_mount          # Universal method

Always unmount before shutdown to prevent data corruption.

Common mount options

Pass options with the -o flag:

Mount SSHFS with permissions and reconnect options
sshfs -o allow_other,default_permissions,compression=yes,reconnect,ServerAliveInterval=15,ServerAliveCountMax=3 user@host:/path ~/mount
Option Purpose
allow_other Allows other users to access the mounted filesystem
default_permissions Kernel enforces standard permission checks
compression=yes Reduces bandwidth usage at the cost of increased CPU usage
cache_timeout=60 Caches file attributes for 60 seconds to improve performance
reconnect Automatically reconnects if the connection drops
ServerAliveInterval=15 Sends keepalive packets every 15 seconds
ServerAliveCountMax=3 Disconnects after 45 seconds if no response is received

Fuse options reference

idmap=user maps remote UID and GID to the local user.

uid=1000,gid=1000 forces specific user and group IDs (find yours with the id command).

ro mounts the filesystem read-only.

noauto_cache disables caching (use when files change frequently).

cache=yes enables caching for better read performance.

kernel_cache enables kernel-level caching (best performance; use only when remote files will not change).

Permanent mount with fstab

Edit /etc/fstab with sudo:

Configure an SSHFS mount in fstab
user@host:/remote/path /mnt/remote fuse.sshfs noauto,x-systemd.automount,_netdev,reconnect,ServerAliveInterval=15,ServerAliveCountMax=3,IdentityFile=/home/user/.ssh/id_ed25519 0 0

Key options:

  • noauto: Prevents mounting at boot.
  • x-systemd.automount: Mounts on first access.
  • _netdev: Marks as a network filesystem and prevents boot errors.
  • IdentityFile: Specifies the SSH key path.

Security note: Automounting requires passwordless SSH keys.

Reload systemd: sudo systemctl daemon-reload && mount /mnt/remote.

Need reliable VPS storage for SSHFS mounts?

Use Virtarix VPS infrastructure with root access, NVMe storage, snapshots, backups, and predictable resources for remote filesystem workflows.

systemd automount unit

Create /etc/systemd/system/remote.mount:

Define the SSHFS unit dependencies
[Unit]
Description=SSHFS mount
After=network-online.target
Wants=network-online.target
Define the SSHFS mount unit
[Mount]
What=user@host:/path
Where=/mnt/remote
Type=fuse.sshfs
Options=_netdev,reconnect,ServerAliveInterval=15,ServerAliveCountMax=3,idmap=user,IdentityFile=/home/user/.ssh/id_ed25519
Enable the SSHFS mount target
[Install]
WantedBy=multi-user.target

Create a mount point with sudo mkdir -p /mnt/remote.

Enable it with sudo systemctl enable --now remote.mount.

Performance tuning

For slow connections: Use compression=yes (trades CPU for bandwidth).

For fast networks: Skip compression (adds overhead).

For read-heavy workloads: Use cache=yes,kernel_cache.

Modern ciphers:

  • With AES-NI: -o Ciphers=aes256-gcm@openssh.com.
  • Without AES-NI: -o Ciphers=chacha20-poly1305@openssh.com.

SSH keys: Use Ed25519 (ssh-keygen -t ed25519) for smaller, faster, more secure keys than RSA.

Security best practices

Verify host keys on first connection to prevent man-in-the-middle attacks.

Use SSH key authentication. Generate keys with:

Generate an Ed25519 SSH key
ssh-keygen -t ed25519
Restrict the private key permissions
chmod 600 ~/.ssh/id_ed25519
Restrict the SSH directory permissions
chmod 700 ~/.ssh

Avoid using SSHFS over untrusted networks without VPN protection. Use unique keys for different purposes. If compromised, revoke without affecting other services.

Troubleshooting

Check active mounts

Find active SSHFS mounts
mount | grep sshfs

Debug connection

Debug an SSHFS connection
sshfs -d user@remote.host:/path ~/mount  # Verbose output

Press Ctrl+C to exit debug mode.

Permission denied

Inspect and repair SSHFS mount permissions
ls -ld ~/mount
chown $USER:$USER ~/mount
chmod 755 ~/mount
ssh user@remote.host "ls -ld /remote/path"  # Verify remote permissions

Stale mount

Force-unmount a stale SSHFS mount
fusermount3 -uz ~/mount  # Force unmount

The -u flag unmounts; -z allows a lazy unmount if busy.

Hung mounts after network loss

Mount with timeouts:

Mount SSHFS with reconnect timeouts
sshfs -o reconnect,ServerAliveInterval=15,ServerAliveCountMax=3 user@host:/path ~/mount

This causes operations to timeout after 45 seconds of network loss, preventing applications from hanging indefinitely.

Device busy

Find blockers and lazy-unmount the device
lsof +f -- ~/mount  # Find processes
umount -l ~/mount   # Lazy unmount

Lazy unmount detaches the mount point immediately, but cleans up when nothing is using it.

Use cases

Remote backups: Mount the backup directory and run rsync. For large operations, use rsync directly over SSH for better performance.

Code editing: Mount the remote dev directory and edit with a local IDE like VSCode or Sublime. Changes are saved directly to the server.

NAS access: Mount storage at /mnt/nas for convenient file access.

Data analysis: Mount remote datasets and analyze with local tools. Great for data science workflows with frequent data inspection.

Important limitations

  • High latency = slow performance: Every operation requires a server round-trip
  • Poor random access to large files: Database files and VM images perform badly
  • No file locking between clients: Multiple users may overwrite changes (use NFS or version control for collaboration)
  • Not POSIX compliant: Hard links and extended attributes may not work (avoid for system directories)
  • Many small files degrade performance: Operations like find are very slow (use rsync for bulk transfers)

Security = SSH connection security: Use strong SSH keys with proper permissions

Conclusion

You can now mount remote filesystems over SSH, set up automatic mounts with reconnection, and troubleshoot issues. Start with basic mounts to get familiar. Add compression and caching for your workload. Set up persistent mounts for frequently accessed directories.

Always unmount before shutdown. Use reconnect and ServerAliveInterval for reliable connections. Tune cache and compression based on your network. SSHFS provides secure, efficient remote file access for development, data analysis, and collaboration workflows.

Ready to run SSHFS and remote storage workflows on Virtarix VPS?

Compare VPS sizes for remote mounts, file operations, backups, root access, NVMe storage, IPv4 + IPv6, snapshots, and storage headroom.

Storage VPS S

For backups, media and small archives

$ 8 .00 /month
  • 2 CPU cores
  • 4 GB RAM
  • 200 GB NVMe
  • Unlimited
Get It Now
BEST SELLER

Storage VPS M

For growing files and app storage

$ 16 .00 /month
  • 4 CPU cores
  • 8 GB RAM
  • 400 GB NVMe
  • Unlimited
Get It Now
Peter French
About the Author Peter Frenchis the Managing Director at Virtarix, with over 17 years in the tech industry. He has co-founded a cloud storage business, led strategy at a global cloud computing leader, and driven market growth in cybersecurity and data protection.