Mount a remote directory via SSH on MacOS (SSHFS)

Published by Tobias Hofmann on

4 min read

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.

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
Ein Bild, das Text enthält.

Automatisch generierte Beschreibung
df -h
Ein Bild, das Text, Rechner enthält.

Automatisch generierte Beschreibung

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

Resources

https://en.wikipedia.org/wiki/SSHFS

https://github.com/libfuse/sshfs

Let the world know
Categories: Technology

Tobias Hofmann

Doing stuff with SAP since 1998. Open, web, UX, cloud. I am not a Basis guy, but very knowledgeable about Basis stuff, as it's the foundation of everything I do (DevOps). Performance is king, and unit tests is something I actually do. Developing HTML5 apps when HTML5 wasn't around. HCP/SCP user since 2012, NetWeaver since 2002, ABAP since 1998.

1 Comment

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/

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.