Update 2016-08-03: I found that installing SSHFS from https://osxfuse.github.io is stabler than the homebrew version, because of some old dependency (therefore this may improve in the future).
CAVEAT: This connection is super fast when it works, but often has issues after terminated connects due e.g. wireless, standby.
Assumes you have Homebrew installed (make your life easier and get this first)
Installation of SSHFS
brew install sshfs
Check this folder to see installed file systems:
If you don't see
osxfusefs.fs, you need to install it.
brew tap caskroom/cask
brew cask install osxfuse
Alternatively instead of homebrew use the download versions from
SSHFS + OSXFUSE Now Installed. One more step...
/usr/local/bin/sshfs should be also available as
compgen -c | grep ^mount
ls /sbin | grep mount
If you do not see mount_sshfs, the you need to do this step. This is a critical step because it is easily forgotten and may create headaches.
sudo ln -s $(which sshfs) /sbin/mount_sshfs
Add Autostart at Boot Daemon in
File could be called:
You need to run this at every boot for the kernel extension:
/bin/bash -c "/Library/Filesystems/osxfusefs.fs/Support/load_osxfusefs; /usr/sbin/sysctl -w osxfuse.tunables.allow_other=1"
So create a new service file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<string>/Library/Filesystems/osxfusefs.fs/Support/load_osxfusefs; /usr/sbin/sysctl -w osxfuse.tunables.allow_other=1</string>
launchctl (launchd) for next boot, which is the Mac OS X version of
launchctl load /Library/LaunchDaemon/load.osxfusefs.tunables.plist
Setup auto_master and auto_sshfs
The following assumes you can ssh into your server with a secure key (no password required).
/mnt/sshfs auto_sshfs -nosuid
You could use parameters that normally come after the
sshfs -o depending on your situation.
- idmap=user: default setting. since your uid and gid is probably different across operating systems, you could just map the user used in the user@ip: to your local (client) user. The group will be ignored in this case (which means folders not owned by you yet grant you read permissions on the server-side group may not be readable locally--on the client side)
uid=YOURUSERID, gid=YOURGROUPID: just type id YOURUSER to get the numbers. This will just map all files from the mount to this user/group combination. This will allow you to read all files. I think any new files/folders you create will inherit the default umask settings for whichever folder you mount.
allow-other: I use this, but is is risky because any user who browses the mount will view the mount using the credentials used when connecting.
list all parameters with
man sshfs and read see each parameter after every
- YOURUSER with your username and
- PRIVATEKEY to your key e.g. id_ed25519
- ip with your ip address or hostname
Important is the parameter
reconnect, otherwise whenever you loose connection (like go to sleep), Finder will crash.
- $(id -u) with your actual id on client machine
- $(id -g) with your actual group id on client machine
Unfortunately you cannot execute things in autofs like
NameOfMountThatGetsIgnored -fstype=sshfs,port=22,reconnect,uid=$(id -u),gid=$(id -g),follow_symlinks,allow_other,IdentityFile=/Users/YOURUSER/.ssh/PRIVATEKEY,volname="NameOfMount" YOURUSER@ip:/path/on/server
df -Ph /path/to/mount
List mounted filesystems
List all mounts