SSHFS Mount Remote File System Over SSH
In this article
SSHFS lets you mount a remote directory over SSH as if it were a local folder, so you can browse, edit, and transfer files using your normal file manager or command-line tools. You’ll need SSH access to the remote machine (username, host, and password or key) and the SSHFS package installed locally. This guide walks through the entire process on Linux and macOS, including troubleshooting common issues.
What You'll Need
- A remote computer with SSH enabled (Linux, macOS, or Windows with OpenSSH server).
- SSH credentials: username, hostname or IP, and password or SSH key.
- Local machine with SSHFS installed (see Step 1).
- Optional:
fuseorfuse3package (usually a dependency).
Step-by-Step
- Install SSHFS on your local machine.
- Debian/Ubuntu:
sudo apt update && sudo apt install sshfs - Fedora/RHEL:
sudo dnf install fuse-sshfs - Arch:
sudo pacman -S sshfs - macOS: Install macFUSE first, then
brew install sshfs(requires Homebrew).
- Debian/Ubuntu:
- Create a local mount point. This is the folder where the remote files will appear. For example:
mkdir ~/remote-files - Test SSH connectivity. Run
ssh user@host(replace with your details). If you can log in, SSH works. Exit the session. - Mount the remote directory. Use the basic syntax:
sshfs user@host:/remote/path /local/mountpoint
For example:sshfs john@192.168.1.10:/home/john ~/remote-filesYou’ll be prompted for your SSH password. After entering it, the remote directory is mounted. - Verify the mount. Run
ls ~/remote-filesto see the remote content. You can also usedf -h ~/remote-filesto confirm the mount. - Unmount when done. To detach, use:
- Linux:
fusermount -u ~/remote-files(orumount ~/remote-fileson newer systems) - macOS:
umount ~/remote-files
- Linux:
- Optional: Use SSH keys for passwordless mounting. Generate a key with
ssh-keygen, copy it to the remote host withssh-copy-id user@host, then SSHFS won’t prompt for a password. - Optional: Mount automatically at boot. Add an entry to
/etc/fstab(Linux). For example:user@host:/remote/path /local/mountpoint fuse.sshfs defaults,_netdev,allow_other,uid=1000,gid=1000 0 0
Test withsudo mount -abefore rebooting.
Common Mistakes
- Forgetting the colon in
user@host:/path– the colon separates host from path. - Using a relative path for the remote directory – always use an absolute path (e.g.,
/home/user, not~/). - Mount point not empty – if the local folder has files, they’ll be hidden while mounted.
- Typing the password every time – use SSH keys to avoid this.
- Not having permission to access the mount point – ensure the local folder is owned by your user.
Tips
- Use
-o reconnectto automatically reconnect if the connection drops:sshfs user@host:/path ~/mount -o reconnect - Add
-o compression=yesto reduce bandwidth over slow connections. - For better performance over high-latency links, try
-o Ciphers=aes128-ctror-o Compression=yes. - To allow other users on your system to access the mount, use
-o allow_other(may require editing/etc/fuse.conf). - Use
sshfs -o idmap=userto map remote UIDs to your local user, which avoids permission issues.
Troubleshooting
- “fuse: device not found” – The FUSE kernel module isn’t loaded. Run
sudo modprobe fuse(Linux) or ensure macFUSE is installed (macOS). - “Connection refused” – SSH isn’t running on the remote host, or a firewall blocks port 22. Check with
ssh user@host. - Permission denied – Wrong username or password, or SSH key not set up. Verify you can log in via SSH first.
- Mount point “Transport endpoint is not connected” – The connection dropped. Unmount with
fusermount -u(orumount -l) and remount. - “Host key verification failed” – The remote host key changed. Remove the old key from
~/.ssh/known_hosts(be careful – this is a security risk if you’re not sure why it changed). - Slow transfer speeds – Try disabling compression or using a different cipher. Also check network latency.
Frequently Asked Questions
Can I mount a remote directory over the internet?
Yes, as long as SSH is reachable (port 22 forwarded or VPN). Just use the public IP or hostname.
Is SSHFS safe?
It uses the same encryption as SSH, so data is secure in transit. However, anyone with access to your local mount point can see the files, so use proper permissions.
Can I mount a Windows machine with SSHFS?
Yes, if the Windows machine runs OpenSSH Server (available as a feature in Windows 10/11). The remote path would be something like C:/Users/name.
Why does my mount disappear after a reboot?
SSHFS mounts are temporary by default. To make them persistent, add an entry to /etc/fstab or use an autofs configuration.
Can I use SSHFS on Android?
Yes, apps like “SSHFS” or “CIFS Manager” (with root) can mount remote folders, but it’s not as straightforward as on desktop.
What’s the difference between SSHFS and SCP/SFTP?
SCP and SFTP are for one-off file transfers. SSHFS gives you a live, mounted filesystem that behaves like a local drive, so you can use any application to read/write files.