sshfs is primarily the work of Miklos Szeredi, a Linux hacker from Budapest who is better-known as the creator of FUSE, the Filesystem in USErspace framework that makes sshfs possible. Szeredi was already working on FUSE when he discovered Florin Malita's similar project named LUFS and its SSHFS filesystem.
Szeredi liked the idea of an SSH-protected filesystem enough that he wrote a LUFS wrapper to allow him to use Malita's SSHFS in FUSE. Unhappy with the performance and lack of multi-threading, though, he eventually decided to implement his own sshfs native to FUSE.
The FUSE library and kernel module -- which joined the official Linux kernel in 2.6.14 -- enable non-root users and unprivileged programs to create and mount filesystems entirely in user space. This has led to a flurry of FUSE-based projects, providing filesystem interfaces to everything from USB-attached digital cameras to remote Gmail accounts.
Preparation
But sshfs is one of the more straightforward FUSE filesystems, and thus a good place to begin for those new to FUSE. To get started, make sure that you have FUSE installed and working on your local machine. If your distribution is up-to-date, a binary package may be available to you already.
If not, you can download the source code for libfuse and the kernel module from the project's SourceForge page. Once it's installed, no further configuration is required, but you must issue a modprobe fuse command to make sure that the FUSE kernel module is loaded. You may also want to add yourself to the fuse group so you can work with FUSE without having to be root.
Next, download the sshfs source. Extract it and run ./configure and make && make install. sshfs utilizes OpenSSH's sftp package, so make sure that you have it installed on your local machine too.
You can connect to any other machine reachable via ssh; no special setup is required on the remote host. sshfs supports both SSH1 and SSH2 protocols, defaulting (as do most other tools) to SSH2. If you haven't used ssh before, you will need to generate a key pair and perform some basic ssh configuration. See the tutorials at OpenSSH.com for more help.
Connection
The general form for mounting an sshfs filesystem is sshfs username@remote_hostname:directory local_mount_point -- where username is the username of your account on the remote host. If it is the same as your local username, you may safely omit it and the @ sign.
If you do not specify a directory on the remote host, the user account's home directory is assumed -- but you must not omit the trailing colon in this case (e.g., sshfs nate@www.nateshandmadedoilies.com: ~/webstuff).
Once the remote directory is mounted, it behaves like any other local filesystem, visible to all scripts and applications, but over an end-to-end encrypted channel. You can browse and drag-and-drop files with Nautilus or Konqueror, edit files as if they were local, even work with a CVS repository.
When you are done working, the command fusermount -u local_mount_point unmounts the filesystem and tears down the connection.
If you intend to make regular use of an sshfs filesystem, you can add it to /etc/fstab and have it mounted automatically. Before doing this, however, make sure that the FUSE kernel module is loaded at startup time by adding it to /etc/modules.
Observation
Read and write performance is fast with sshfs. To get a feel for the system, I connected to an off-site backup server over my cable modem and tried to work my usual routine to compare real-world performance. I found no discernible time difference between commands acting on the remote system and local files. By contrast, NFS mounts frequently incur a noticeable lag, and WebDAV is slower than molasses.
Of course, two of the advantages to WebDAV are the collaborative editing of documents and revision tracking, which sshfs is not designed for. On the other hand, sshfs is far superior to scp because the entire command-line toolset operates on it.
For moving files from one machine to another, scp does a fine job -- but when it comes to searching, batch operations, cron jobs, or editing in place, sshfs wins hands down. As Szeredi told me, the convenience of filename auto-completion alone makes the whole system worthwhile.
sshfs reached version 1.0 last January. The current 1.3 release is essentially feature-complete, though Szeredi says there is still some work to be done. Certain command-line tools (such as df) do not work properly due to shortcomings in the OpenSSH implementation of sftp. To work around these holes, sshfs has to estimate disk usage and free space, which could complicate its usage for some tasks.
But even when it is completed, Szeredi points out that sshfs will not replace high-end systems like NFS or VPNs. It is intended only to provide fast, convenient access to remote directories, and do so securely, and with no configuration required on the remote host.
Note: Comments are owned by the poster. We are not responsible for their content.
Nate
What makes sshfs good is that it works without having to go through the GUI file manager; therefore it works for all command line tools, scripts, etc.
Also, I don't agree that the sshfs instructions in the article are more of a "complication" than any other method. A lot of the "complication" of using sshfs is really SSH complexity -- which users will need to do in order to access SSH shares via KDE or GNOME GUI clients as well. For a side-by-side comparison, you'd need to add that setup to the Konqueror instructions as well.
I also took some space to describe how to install FUSE, because users need to know how to do that until all distros ship with FUSE configured by default; for comparison's sake you'd have to add in instructions for installing Konqueror, or alternatively compare methods on a system with FUSE built-in.
And last but not least, part of the instructions relate to having sshfs mount remote SSH shares on startup, something not addressed in these Konqueror instructions. I don't even know if you can mount remote volumes on startup using Konqueror or Nautilus, but something tells me you can't, as they're interactive GUI apps.
Don't misunderstand me; I'm not knocking Konqueror. It's just that sshfs is extremely easy to set up, very difficult to mess up, and the parent post was really comparing apples and oranges.
Nate
Of course, I also meant to suggest sarcastically that interactive GUI apps never do anything that useful in the long term. Perhaps that got lost in the shuffle. To make up for it, I've gone back and added extra sarcasm to the above paragraph; taking subtle potshots at GUI apps in general. Hopefully posterity will judge the entire exchange as funny, if not helpful.
Wait a minute; I'm spending too much time replying to this post. You agreed with me about sshfs, after all. That's weird.... I should go find somebody who didn't. Ciao.
Nate
fish://
Posted by: Akhmad Fathonih on November 22, 2005 07:56 AMJut as simpel as: fish://remote.host
#