Mount a remote directory via SSH on MacOS (SSHFS)
Mounting a remote directory is a very common use case. A file server provides a central place to store documents, and users can use these like a normal local folder on their laptop. Sometimes the file server is only available via SSH access. In that case, you cannot mount a share via e.g. Samba/CIFS. SCP allows to not only log on via SSH, but also to copy files. Binary files can be transferred, and this allows to use SSH access to remotely mount a directory like a file share. This is very handy for MacOS users. It is possible to mount a remote share via SSH and access the directory like a normal mounted share in Finder.
This won’t work out of the box and some external software is needed. The tool that mounts remote directory via SSH is SSHFS.
- Get the required software from the Fuse for OSX site: https://osxfuse.github.io/
- You need FUSE for macOS and SSHFS. https://github.com/osxfuse/osxfuse/releases
Install OSX Fuse
The installation wizard opens und guides you through the installation steps.
You’ll also need to allow the execution of the program. After everything is installed without error, the installation wizard ends.
Install SSHFS
After installing Fuse for OSX, you can install SSHFS.
Mount remote SSH directory
SSHFS is now operational. Open a new terminal window and run sshfs.
To mount the directory /mnt/md0 from a remote server to the local directory md0:
sshfs user@10.0.8.40:/mnt/md0/ ./md0/ -ocache=no -onolocalcaches -ovolname=ssh
or:
sshfs user@10.8.0.40:/mnt/raid/md0 ./md0/
To see how the remote directory is mounted, use mount
mount
df -h
Troubleshooting
mount_osxfuse: the file system is not available (255)
After installing Fuse for MacOS, reboot your laptop.
If a reboot is not solving a problem, it may be related to the internal smbfs module. Unload it and try to mount the directory with sshfs again.
sudo kextunload -b com.apple.filesystems.smbfs
2 Comments
Adrian · September 26, 2022 at 22:56
Check out SSHFS-Mountlet which provides a GUI on top of SSHFS and Fuse:
https://ente.limmat.ch/ftp/pub/software/applications/SSHFS-Mountlet/
Storm · March 2, 2023 at 09:43
doesn’t work on OSX Ventura 13.2.1