Copying the same files between a laptop and a server gets tiring quickly. SSHFS offers a convenient alternative: mount a remote directory in your Linux home folder, then browse it with familiar tools. It is useful for inspecting project files or reading logs, provided you understand what happens when the network disappears.
This guide uses a Linux client and an SSH server with SFTP enabled. Replace every example username, host and remote path with values for a server you are authorized to access. The commands are a documented workflow, not a test of your particular server.
SSHFS combines a local FUSE filesystem with remote SFTP access over SSH. Install SSHFS on the client; the remote account needs working SFTP access and permission to the requested directory. An installed SSH server alone does not guarantee that its SFTP subsystem is enabled.
Treat the mount as a live view of remote files. Deleting a file through a writable mount can delete the server copy. Network latency, caching and connection failures also make it different from a local disk. Avoid using it for active database storage or workloads that depend on local filesystem semantics; a mount is not a backup.
On an Ubuntu or Debian client with the package available in its configured repositories:
sudo apt update
sudo apt install sshfs
sshfs --version
Other distributions package FUSE and SSHFS differently. Use the distribution’s supported package instructions rather than copying old CentOS package names.
sftp editor@server.example.com
On the first connection, verify the host-key fingerprint through a trusted administrator or provider channel before accepting it. At the SFTP prompt, check the permitted directory with pwd and ls, then enter bye. An SFTP-only account may have a restricted path that differs from the host’s full filesystem.
mkdir -p "$HOME/mnt/project"
sshfs editor@server.example.com:/srv/project "$HOME/mnt/project" -o ro
ls -la "$HOME/mnt/project"
Choose an empty mount directory you own. The ro option makes this first mount read-only. After confirming the path and access policy, unmount it and omit -o ro only if you need write access. Do not run the routine mount with sudo.
For an account that permits key authentication, create a dedicated key if you do not already have an appropriate one. Choose a passphrase and keep the private key on the client; send only the public key through the server’s approved enrollment process.
ssh-keygen -t ed25519 -f "$HOME/.ssh/id_ed25519_project"
A server using SSH port 2222 and that identity can be mounted as follows. Verify its host key and SFTP access on the same port first, using sftp -P 2222.
sshfs -p 2222 editor@server.example.com:/srv/project "$HOME/mnt/project" \
-o IdentityFile="$HOME/.ssh/id_ed25519_project",ro
Key authentication avoids repeatedly entering the account password; a passphrase-protected key may still need unlocking through an SSH agent. Never remove host-key verification to make a connection error disappear.
sshfs editor@server.example.com:/srv/project "$HOME/mnt/project" \
-o ro,reconnect,ServerAliveInterval=15,ServerAliveCountMax=3
Use this command instead of the earlier mount, not on top of it. Keepalive options help detect an unresponsive connection; reconnect attempts to restore it. They do not protect in-flight work: previously open files can fail and need reopening, and interrupted reads or writes can lose data.
fusermount3 -u "$HOME/mnt/project"
Save and close files first, then move any terminal out of the mounted directory. Some older distributions use fusermount -u; consult the installed manual. If unmounting reports a busy resource, identify the application still using the mount rather than immediately forcing it.
| Symptom | What to check | |
|---|---|---|
| 1 | Permission denied | Account authentication, remote path permissions and SFTP restrictions. |
| 2 | Connection refused or timeout | Correct host and port, network route, firewall policy and SSH service. |
| 3 | Transport endpoint is not connected | Close affected applications, unmount the stale mount and reconnect after restoring connectivity. |
| 4 | Unexpected ownership or access | Remote identity and UID/GID mapping. Review idmap=user and default_permissions in the installed manual. |
| 5 | Slow browsing | Network latency, file count and workload. Consider SFTP transfer or a deliberate synchronization workflow instead. |
Keep the default restriction to the mounting user. allow_other broadens local access and needs a deliberate permissions review. For persistence, design an on-demand mount using your distribution’s current service guidance, credentials and failure behavior; an old blanket fstab entry can create boot or access problems.
Use SSHFS when interactive remote file access is the goal. Use a transfer or synchronization tool when you need an independent local copy, and a real backup system when you need recovery. Which files do you need to inspect remotely, and would a read-only mount be enough?
For a mount that survives network blips, use options such as reconnect and ServerAliveInterval so the connection recovers and idle sessions are not dropped. Key-based authentication is safer and lets you mount without typing a password each time.
To mount automatically, add an entry in the file systems table using the sshfs type, a network-dependent option and an identity file. Test it with a manual mount command before rebooting, so a typo does not delay boot.
Unmount a user mount with fusermount using the unmount option. If you see permission denied, check key permissions and the remote path. A stale mount that hangs usually needs a lazy unmount, then a fresh mount.
Restrict the remote account to the directories it needs and avoid mounting as root. SSHFS suits convenient access and small tasks; for heavy workloads or many small files, consider NFS or rsync instead.
Is SSHFS encrypted? Yes, it travels over SSH.
Can I use it on macOS or Windows? Third-party tools exist, though Linux support is the most mature.
Why is it slow? Latency and many small reads add overhead; try caching options or another tool.
Related reading: Linux Disk Space Full? 7 Safe Checks to Find the Cause · Ubuntu System Restart Required: 5 Safe Reboot Checks
Keep exploring: See all security and encryption guides.
The Nandan Sinha newsletter
Get new articles on technology, practical guides, wellbeing and spirituality, delivered to your inbox.
Subscribe by email. Confirm your address to join. Unsubscribe anytime. Privacy policy.
We use essential cookies to run this website and optional cookies for analytics and advertising. Choose Accept All, Reject, or Preferences to manage optional cookies. You can change your choice at any time.
Manage your cookie preferences below:
Essential cookies enable basic functions and are necessary for the proper function of the website.
These cookies are needed for adding comments on this website.
Google's current Sign in with Google client library. It renders the Google sign-in button, or the One Tap prompt, so visitors can log in to your site with their Google account. It replaces the older Google Sign-In platform library.
Service URL: policies.google.com (opens in a new window)
Google Tag Manager simplifies the management of marketing tags on your website without code changes.
Statistics cookies collect information anonymously. This information helps us understand how visitors use our website.
Google Analytics is a powerful tool that tracks and analyzes website traffic for informed marketing decisions.
Service URL: policies.google.com (opens in a new window)
Marketing cookies are used to follow visitors to websites. The intention is to show ads that are relevant and engaging to the individual user.
AddToAny provides share and follow buttons that let visitors post your pages to social networks, messaging apps, and bookmarking services.
Service URL: www.addtoany.com (opens in a new window)
You can find more information in our Privacy Policy and Privacy Policy.





Leave a Reply