sshfs

Setting up sshfs on OS X (Mac) systems

Installation requires administrative privileges.

Prior to installing, you should make sure that you can SSH with keys

  1. Download OSXFuse (dmg) (pkg) from http://osxfuse.github.io
  2. Open OSXFuse dmg , run installer
  3. Download SSHFS (pkg) from from http://osxfuse.github.io
  4. Run SSHFS installer pkg
  5. Create a folder to access the remote filesystems (aka a mount point): mkdir /sshfs/

Mounting remote filesystems with sshfs

sshfs username@remotesystem:/full/path/to/directory /mount/point

For example, sshfs meyer@schl15:/nfs/userdocs/ps/meyer ~/userdocs/home would use schl15 as a host to access the directory /nfs/userdocs/ps/meyer (in other words, that user's NFS home directory).

You should mount sshfs via a directory in your home directory. Just remember to specify the PATH to the directory.

OS X (Mac) helpful hints

As of OSX 10.15 Catilina we are not recommending to create mounts in the root path or / of the file system.

An example of mounting from OSX on your local system is as follows -

mkdir ~/userdocs
/usr/local/bin/sshfs oconnor@xtal200.harvard.edu:/nfs/userdocs /Users/oconnor/userdocs -o volname=userdocs,reconnect,ServerAliveInterval=15,ServerAliveCountMax=3,idmap=user,auto_xattr,dev,suid,defer_permissions,noappledouble,noapplexattr

You should mount one complete filesystem from the remote site, so this would be anything listed in /nfs for example. This avoids local Apple Finder issues. We give the volume a name volname=userdocs (shows mount point on your desktop), add some additional options for server connections, etc. If you are using an key-based-ssh you would add it's path to the IdentityFile paramater - adding ,IdentityFile=$HOME/.ssh/id_rsa to the end of the line.

Unmounting remote filesystems

On occasion the mount may become stuck or unresponsive you can force unmount via - diskutil umount force /Users/oconnor/userdocs

Using helper script

We created a 'helper' script available that can be used with sshfs_nfs.app for mac to automount at login. The app is simply a wrapper for sshfs-helper.sh and assumes the script exists in your home folder.

If the mounts become stuck just rerun to reattach shares.

scp $USER@xtal200.harvard.edu:/net/cronus/cmcd1/arc/shared/sshfs-helper.sh .

or copy the whole set -

rsync -rlptD $USER@xtal200.harvard.edu:/net/cronus/cmcd1/arc/shared/sbgrid-sshfsfiles.zip .

The script will create a file in your home folder called .sshfs-mounts

You can add or change any number of mounts that sshfs-helper.sh -

To open - open .sshfs_mounts then edit in textedit.app.

An example - #USER@HOST REMOTE_FOLDER LOCAL_FOLDER | empty local folder must exist oconnor@sshfs.sbgrid.org /nfs/userdocs /Users/oconnor/userdocs jo232@transfer.o2.hms.harvard.edu /home/myfolder /Users/oconnor/o2home

«««< HEAD After it is working you can add a shortcut into your dock by navigating to your home folder on your Mac open ~ and then dragging the sshfs_nfs.app into your dock. If you need to reconnect to the shares just press the app and it will connect or reconnect. ======= For additional folders you must create the destination folder like - mkdir ~/o2home

After it is working you can add a shortcut into your dock by navigating to /Users/Shared/ on your Mac open /Users/Shared and then dragging the sshfs_nfs.app into your dock. If you need to reconnect to the shares just press the app and it will connect or reconnect.

8aa79253b37400a03ebc3816d37b7965d8a64915