How to Mount Remote File Systems via SSHFS on macOS

August 22, 2024

Introduction

SSH File System (SSHFS) is a file system client that allows you to mount and access directories on remote computers. It uses SSH File Transfer Protocol (SFTP) to establish a secure connection and provide remote file access.

This article will show you how to mount remote file systems in macOS using SSHFS.

How to mount remote file systems via SSHFS on macOS.

Prerequisites

  • Access to Terminal.
  • Administrative privileges on the local macOS system.
  • Remote user credentials.

Install SSHFS and macFUSE on macOS

SSHFS on macOS requires the macFUSE software package, which provides a set of APIs allowing the system to handle non-native file store types. Follow the steps below to download and install SHHFS and macFUSE.

Step 1: Download Packages

Visit the official macFUSE website. Download the latest stable SSHFS and macFUSE installation packages from the Stable Releases section of the main page.

The official website of macFUSE with the Stable Releases download section.

Step 2: Install SSHFS

As of writing this article, SSHFS supports Intel-based Macs only. However, Apple Silicon users can install the Rosetta compatibility layer and run SSHFS on their systems.

The below steps show the SSHFS installation procedure:

1. Locate and start the SSHFS PKG installer. Select Continue to proceed to the next page.

The first page of the SSHFS installer.

2. If the installation is performed on an Apple Silicon system with Rosetta not installed, a prompt asks to set up Rosetta before continuing with the SSHFS installation. Select Install and wait for the procedure to finish.

The message prompting user to install Rosetta.

Once Rosetta is installed, the SSHFS setup resumes automatically.

3. Finish installing SSHFS by following the installer prompts.

Step 3: Install macFUSE

Since macFUSE is a system extension that modifies how the kernel handles file systems, installing it requires modifications in the macOS Startup Security Utility. Follow the steps below to install and enable macFUSE on macOS:

1. Start the macFUSE DMG installer. Follow the installer prompts to install the extension.

The first page of the macFUSE installer.

2. When the system finishes installing macFUSE, a message appears stating that the system extension could not be loaded. Click the Open Privacy & Security System Settings button to proceed.

The prompt asking to allow loading system software in the Privacy & Security section of System Settings.

3. Click the Enable System Extensions button in the Privacy & Security section of the System Settings.

The location of the Enable System Settings button in the Privacy & Security section.

4. Ensure all your work in the current OS session is saved and select Shut Down to power off the computer.

Shutting down the computer to access the Startup Security Utility.

5. When turning the computer back on, long-press the power button to enable additional startup options.

6. Select Options from the boot list.

7. Log in with your user.

8. Select Startup Security Utility from the Utilities section in the top menu.

9. Select the disk containing the macOS installation (usually called Macintosh HD), and click the Security Policy button.

10. Select the Reduced Security option and check the box to Allow user management of kernel extensions from identified developers.

11. Click OK to confirm and restart the computer.

12. Return to the Privacy & Security section in System Settings and select the Allow button to load macFUSE.

Allowing macFUSE to run.

13. Restart the computer for the changes to take effect.

Mount Remote File System on macOS

With SSHFS and macFUSE installed, you can mount a remote directory on the local system. Proceed with the steps below to learn how to mount, access, and unmount a remote file system using SSHFS on macOS.

Step 1: Create Mount Point

A mount point is a directory in the local file system through which a remote directory is accessed. Create it with the mkdir command:

mkdir [path]/[directory]

For example, to create a mount point named ubuntu in your home directory, type the following command:

mkdir /Users/[username]/ubuntu

Replace [username] in the command with your actual username.

Step 2: Mount Remote Directory

SSHFS features a CLI that allows different options for mounting remote directories. Below is the basic command syntax:

sshfs -o [options] [user]@[host]:[remote-path] [mount-point]

For example, the following command establishes an SSH connection with the user [email protected] and mounts the remote server's root directory to the previously created /Users/marko/ubuntu mount point.

sshfs [email protected]:/ /Users/marko/ubuntu

Type the remote user password when prompted. SSHFS mounts the remote directory.

Mounting a remote root directory.

If you encounter a problem when connecting to the remote server, run the command below to enable debugging options:

sshfs -o debug,sshfs_debug,loglevel=debug [user]@[host]:[remote-path] [mount-point]

Step 3: Access Remote Directory

Test the connection by going to the mount point directory and typing the ls command:

ls

The system displays the contents of the remote machine's root directory.

Viewing the contents of the remote root directory.

An SSHFS mount can also be accessed through Finder by navigating to the Computer section.

Accessing the mounted volume through Finder.

Step 4: Unmount Remote Directory

To stop using the mount point and break the SSH connection between the systems, eject the relevant macFUSE volume in Finder.

Ejecting the remote volume from Finder.

If you have difficulties ejecting the volume, force unmount it by entering the following command in Terminal:

diskutil umount force [mount-point-directory]

The output shows that unmounting was successful.

Force unmounting a remote directory via CLI.

Conclusion

This article showed you how to mount a remote directory on macOS using the SSHFS file system client. It presented the installation steps for SSHFS and macFUSE and explained the mounting and unmounting procedure.

Use the macOS command-line interface to manage the system more effectively. Read our Mac Terminal Commands article for more information.

Was this article helpful?
YesNo
Marko Aleksic
Marko Aleksić is a Technical Writer at phoenixNAP. His innate curiosity regarding all things IT, combined with over a decade long background in writing, teaching and working in IT-related fields, led him to technical writing, where he has an opportunity to employ his skills and make technology less daunting to everyone.
Next you should read
SSHFS: Mount Remote File Systems on Linux & Windows
August 20, 2024

This article shows how to use SSHFS to mount remote file systems on Linux and Windows.
Read more
How Does SSH Work?
December 17, 2020

The need for a more secure network communication method inspired the creation of the SSH protocol. In this tutorial, we will talk about SSH.
Read more
How to Connect to a Remote Server via SSH
November 23, 2023

This guide explains how to SSH to a remote server from Windows, Linux, or Mac.
Read more
How to Fix "Connection reset by peer" Error
January 19, 2024

This tutorial will show how to fix the error, with an in-depth analysis of the likely causes and the most effective solutions.
Read more