Skip to content
Chris Sarli edited this page Oct 28, 2019 · 21 revisions

SSHFS

Installation

An easy-to-use installer package for the latest version of SSHFS can be downloaded from the SSHFS repository's download section. It supports Mac OS X 10.5 (Intel, PowerPC) and later.

Note: This build of SSHFS is based on the "FUSE for OS X" software, that is not contained in the installer package and has to be installed separately. The latest release of "FUSE for OS X" can be downloaded from http://osxfuse.github.io.

After the installation user has to create a folder, mount point, on their host machines. Then in terminal execute the command:

sshfs username@server:/path-on-server/ ~/path-to-mount-point

Navigate to the previous created folder (mount point). Folder icon should have changed and the folder is now containing the files and folders of the remote machine.

Macfusion

To use Macfusion with the newer "FUSE for OS X"-based version of SSHFS, put Macfusion in your Applications folder and run the following commands in Terminal. See 3. under "Frequently Asked Questions" for more information as to why you might want to use Macfusion.

cd /Applications/Macfusion.app/Contents/PlugIns/sshfs.mfplugin/Contents/Resources
mv sshfs-static sshfs-static.orig
ln -s /usr/local/bin/sshfs sshfs-static

To revert the changes and use the old MacFUSE-based version of SSHFS that ships with Macfusion, run:

cd /Applications/Macfusion.app/Contents/PlugIns/sshfs.mfplugin/Contents/Resources
mv -f sshfs-static.orig sshfs-static

Uninstallation

SSHFS does not come with an uninstaller. To manually remove SSHFS run the following commands in Terminal:

sudo rm /usr/local/bin/sshfs
sudo rm /usr/local/share/man/man1/sshfs.1
sudo pkgutil --forget com.github.osxfuse.pkg.SSHFS

Frequently Asked Questions

1. I am using SSHFS and changed a file "externally" (not through sshfs/"FUSE for OS X") on the server, but in the SSHFS volume, I am not seeing the changes. In fact, when I copy the file through SSHFS, I get the old content, etc.

"FUSE for OS X" itself is not a distributed remote file system! It is a mechanism for building arbitrary file systems. If you change things "externally" to "FUSE for OS X" (like, a file on the remote server in the case of SSHFS), in general, things need to be done proactively to tell "FUSE for OS X" that something has changed, otherwise you will get such "incorrect" behavior. In particular, SSHFS is not meant to replace things such as NFS, AFP, and SMB - it is meant to be a substitute when you do not have any remote file sharing access to a computer, but you do have SFTP access. When you use SSHFS, from the server's standpoint, you are just accessing it using SFTP. It is not as if the server is going to notify an SSHFS client of modifications by other clients.

To make SSHFS (or any other file system) "catch up" better with "remote" changes, there are a few things you can do. You can use the -o auto_cache option. This would make "FUSE for OS X" purge a file's in-kernel buffer cache if a change in the file's size or modification time is detected.

A worse way to have this mode of operation (where you can change things remotely at any time) is to disable caching in SSHFS (look at the various -o cache options in SSHFS, in particular, -o cache=no). Then, additionally, you need to tell "FUSE for OS X" not to cache things on its end, too. You can use the -o nolocalcaches option, which turns off readaheads, the unified buffer cache, and the pathname resolution cache (all in the kernel). At the cost of some overhead, which could be substantial in certain cases, this will give you the behavior where most requests will have to go to the server and will therefore have more up-to-date information. Note that auto_cache is vastly preferred over this approach.

An example command line for this mode of operation could look like the following:

sshfs user@host:/dir /tmp/ssh -ocache=no -onolocalcaches -ovolname=ssh

If you are developing a "FUSE for OS X" file system and you want to handle such scenarios better within your file system, you should consider mounting your file system with the auto_cache option. You also have the option of using the fuse_purge_np() library function directly, although it is likely to be overkill.

2. SSHFS is not reporting the correct "disk space" for the remote "volume"? It seems to have 1,07 TB (1000 GiB) or some such number hardcoded.

Yes, indeed. Remember that there really is not an SSHFS "volume" per se: SSHFS just uses SFTP to provide an apparently local view of a remote directory. SFTP does not give you disk usage or availability for such a remote directory, so SSHFS does not really have a choice but to cook up some value.

3. Is there an graphical user interface for SSHFS that allows me to create favorites and store my passwords in Keychain?

"FUSE for OS X"-based versions of SSHFS can be used with Macfusion. Macfusion is a graphical user interface that includes the MacFUSE-based file systems SSHFS and CurlFtpFS. It allows you to create favorites and to store your passwords in your Keychain. To set up Macfusion to use a "FUSE for OS X"-based version of SSHFS instead of the older MacFUSE-based one that is shipping with it, see section "Installation".

4. I have found a bug in SSHFS. Where should I report it?

Please open an "issue" in the the issue tracker of the SSHFS repository or post your findings to the "FUSE for OS X" Google Group.