Child pages
  • Mounting Network Shares with SSHFS on macOS
Skip to end of metadata
Go to start of metadata

Purpose: Provide instruction on how to install and configure SSHFS to allows the secure mounting of network shares via SSH.

Installing SSHFS (from Terminal):

sudo port install sshfs

Follow the instruction on the terminal and run the following ln command before using macFUSE:

sudo ln -sn /opt/local/Library/Filesystems/macfuse.fs /Library/Filesystems/macfuse.fs

Creating the mount directories

NOTE: SSHFS only allows shares to mount in your home directory
Create a mount directory (items in red should be changed by the user):

Warning: do not use sudo for this command, it will create a permission error

mkdir ~/mnt

Connecting to a network share

Note: If the RSA key for your computer changed recently, consult What to do When a Remote Machines RSA Key has Changed

Warning: do not use sudo for this command, it will create a permission error

sshfs 'username@remote_host:/path/to/file' '/Users/username/mnt' -o volname=desired_volume_name -o local


sshfs '' '/Users/janedoe/mnt' -o volname=janedoe_nethome -o local

The network share should now be mounted to the specified directory and accessible in Finder.

Unmounting the network share

To unmount the network share you created, enter the following command:

umount /path/to/directory

Using sshfs with ssh keys

Create the key on your computer. We recommend using the default key location. You may create a password if you'd like.

host:~ username$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/username/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /Users/username/.ssh/id_rsa.
Your public key has been saved in /Users/username/.ssh/

Copy the key to the server you're mounting from:

ssh-copy-id username@server

Use the following sshfs command to mount the share using your key:

sshfs 'username@remote_host:/path/to/file' '/Users/username/mnt' -o volname=desired_volume_name -o IdentityFile=/Users/username/.ssh/id_rsa -o local

If you encounter issues there are a few other articles which may help:

SSHFS Troubleshooting:

SSHFS Troubleshooting

Filesharing/Accessing Your Network Home (section on using SSHFS GUI):

File Sharing Accessing Your Network Home

  • No labels