FTP, rsync, SCP - there are many ways to access files remotely. SSHFS is the most transparent: you mount a folder on a remote server as a local disk. You just work in it via the Finder, your editor or the terminal, as if the files were local. No extra ports, no separate protocol - pure SSH.
Installation
macOS
brew install sshfs
On newer macOS versions, you also need macFUSE. Install that first via the website or via
brew install --cask macfuse.
Ubuntu / Debian
sudo apt install sshfs
Arch Linux
yay -S sshfs
Fedora / Red Hat
sudo dnf install sshfs
Remote folder mounting
Step 1 - Create a local mountpoint:
mkdir -p ~/shares/server
Step 2 - Mount the remote folder:
sshfs gebruiker@server.nl:/pad/naar/map ~/shares/server
Replace:
user→ your user name on the remote serverserver.nl→ IP address or hostname/path/to/map→ the path on the server you want to mount
Step 3 - Navigate in it like a regular folder:
cd ~/shares/server
ls -la
Or open it in the Finder on macOS:
open ~/shares/server
Convenient options
# Use a different SSH port
sshfs -p 2222 gebruiker@server.nl:/pad ~/shares/server
# Automatically reconnect on loss of connection
sshfs -o reconnect gebruiker@server.nl:/pad ~/shares/server
# Specify SSH key explicitly
sshfs -o IdentityFile=~/.ssh/id_ed25519 gebruiker@server.nl:/pad ~/shares/server
# Combination
sshfs -p 2222 -o reconnect,IdentityFile=~/.ssh/id_ed25519 gebruiker@server.nl:/pad ~/shares/server
Unmounting
# macOS
umount ~/shares/server
# Linux
fusermount -u ~/shares/server
Automatic mounting at login
If you want to make the mount persistent, add it to /etc/fstab (Linux):
gebruiker@server.nl:/pad /home/jou/shares/server fuse.sshfs defaults,_netdev,IdentityFile=/home/jou/.ssh/id_ed25519 0 0
On macOS, you can create a login item or launchd-plist that executes the sshfs command at login.
Safety
- Use SSH keys instead of passwords - faster and more secure
- Limit SSH access via firewall to trusted IP addresses
- Run SSH on a non-standard port to reduce automatic scanning traffic
- Use
AllowUsersin/etc/ssh/sshd_configto restrict access to specific users
Do I need a separate programme besides SSHFS?
No, SSHFS builds on SSH - you just need an existing SSH connection. On macOS, you do need macFUSE as a dependency.
Does the mount remain active after a reboot?
No, not by default. Add the mount to /etc/fstab or use a login item/systemd service to restore it automatically.
Is SSHFS secure?
Yes - all traffic runs via SSH. Use SSH keys instead of passwords for added security and convenience.
Lees het origineel in het Nederlands
← Lees in het Nederlands