sshfs

Yuwei BaoMarch 21, 2023

Why sshfs?

SSHFS allows user to mount a remote filesystem using SFTP so a user can access the folders from server on the local machine. I personally have issue connect my Mac to server using Finder. You can follow this guide [1] to see if you can connect using Finder.

If not, using sshfs will be a good option.

Installation

I use homebrew [2] as my package manager for MacOS . You can check sshfs github page [3] for other installation options

brew install sshfs

Usage

Prepare the folders:

# Enter the local location you want to store sshfs files
mkdir sshfs
cd sshfs
# Make a directory with the name of the server
mkdir SERVER_NAME

Actual usage:

sshfs USER_NAME@SERVER_IP:PATH_TO_THE_REMOTE_FOLDER_YOU_WANT_TO_ACCESS SERVER_NAME

Then you should be able to see a folder in Finder and access server path without downloading files to local. (If you want to download files to local, try scp [4])

Trouble shooting

sshfs USER_NAME@SERVER_IP:PATH_TO_THE_REMOTE_FOLDER_YOU_WANT_TO_ACCESS SERVER_NAME
mount_macfuse: mount point LOCAL_PATH/SERVER_NAME is itself on a macFUSE volume

First, let's check if the it has been mounted already.

ls LOCAL_PATH/SERVER_NAME
ls:SERVER_NAME: Device not configured

Solution:

umount the server then do sshfs. Note: Make sure the remote files are not used when umount.

umount SERVER_NAME
sshfs USER_NAME@SERVER_IP:PATH_TO_THE_REMOTE_FOLDER_YOU_WANT_TO_ACCESS SERVER_NAME

The loading may be slow, which depends on the size of the remote server path you are trying to access.


  1. https://support.apple.com/guide/mac-help/connect-mac-shared-computers-servers-mchlp1140/mac#:~:text=In the Finder on your,Click Connectopen in new window. ↩︎

  2. https://brew.sh/open in new window ↩︎

  3. https://github.com/libfuse/sshfsopen in new window ↩︎

  4. https://www.freecodecamp.org/news/scp-linux-command-example-how-to-ssh-file-transfer-from-remote-to-local/open in new window ↩︎