Cool User File Systems, Part 1: SSHFS

Userspace file systems are one of the coolest storage options in Linux. They allow really creative file systems to be developed without having to go through the kernel gauntlet. This article presents one of them, SSHFS, that allows you to remotely mount a file system using ssh (sftp).

In keeping with our current theme of cool user-space file systems, this article examines the first user-space file system I ever used: SSHFS. SSHFS has a client that can mount and interact with a remote file system as though the file system were local. It uses sftp so it’s as secure as sftp is (I’m not a security expert so I can’t comment on the security of ssh). SSHFS can be very handy for working with remote file systems instead of copying files back and forth from remote systems or having to worry about a shared file system. People have even used it for making backups.

This article is just a quick overview of SSHFS because there are a very large number of SSHFS howto’s for various Linux distributions (Google is your friend). While the basics of installing and running SSHFS are covered here, the various howto’s are much more comprehensive.

Installing SSHFS

Installing SSHFS is actually a pretty easy affair. The first step for any FUSE based file system is to make sure that FUSE itself is included in the kernel or as a module. Many distributions already come with FUSE pre-built in the kernel. There are multiple ways to check if FUSE has been built. For example, on my Ubuntu 8.10 laptop I can look for the module in the latest kernel:

laytonjb@laytonjb-laptop:~$ ls -lsa /lib/modules/2.6.27-17-generic/kernel/fs/fuse
total 96
 4 drwxr-xr-x  2 root root  4096 2010-03-21 16:42 .
 4 drwxr-xr-x 53 root root  4096 2010-03-21 16:42 ..
88 -rw-r--r--  1 root root 83200 2010-03-11 23:57 fuse.ko

So you can see that FUSE has been built as a module (.ko) for the kernel since the file exists. You can also check if the kernel module is loaded by the kernel.

laytonjb@laytonjb-laptop:~$ /sbin/lsmod | grep -i fuse
fuse                   60956  3

These are just two ways you can check if FUSE has been built for your kernel. Another way is to install the kernel source for your distribution and then look at the kernel configuration, “.config”, in the kernel source directory and you can check if FUSE has been added to the kernel itself or as a module.

If you need to build the FUSE module for your running system you will need to follow the directions on the FUSE homepage. But basically it consists of the common steps one uses to build almost any open-source package.

$ ./configure
$ make
$ make install

These steps build a kernel module for the currently running kernel but only if you have the source for your latest kernel and the “configure” script can find it (be sure to do the last step, “make install”, as root).

Once FUSE is installed and working the next step is to install SSHFS. You can install it using the package management tools for your distribution or you can build it from source. It too has the same simple build steps of many open-source applications.

$ ./configure
$ make
$ make install

where the last step is performed as root. Just be sure to read the SSHFS page for package prerequisites. In particular for the recent versions (as of the writing of this article), you will need glib2.

As an example for this article, I will be using SSHFS on my laptop that is running Ubuntu 8.10 and a remote file system. For Ubuntu 8.10, you will need to install glib2 as well as sshfs 2.02-2 (the latest version from the SSHFS homepage is 2.2) which is easily accomplished using the Synaptic package manager.

At this point FUSE and SSHFS should be installed and we’re ready to use SSHFS.


I’m going to use a remote file system I have on a system that is not under my control (it is administered by someone else) that I can access only via ssh (and scp/sftp). The SSHFS webpage recommends not mounting the remote file system as root but instead as a user. So I will mount the remote file system in a directory (mount point) in my home account on the laptop. In particular, I will mount the file system as SSHFS_TEST on my laptop.

The command to mount the remote file system is simple,

$ sshfs remote_system: mount_point

where remote_system is the name of the remote system. If you have a different login on the remote system compared to your local systems then you need to use “remote_system” in the form, “user@remote_system”.

For this particular example, the screen shot to mount the remote system is below.

laytonjb@laytonjb-laptop:~$ sshfs [system]:[home_root]/laytonjb /home/laytonjb/SSHFS_TEST

I have removed the details to protect the innocent. The term, [system], is the name of the system, and [home_root] is the full root directory to my account on the remote system except for my login name. The last term, “/home/laytonjb/SSHFS_TEST”, is the local mount point. Note that you may have to give your password when performing the mount but after that you should not have to use your password.

If you have problems with SSHFS, then you may have problems with ssh. If you can’t mount the file system or if you get an error, you can check the problem(s) by just using ssh to the remote system. You should also check scp and sftp to make sure they are working.

Now that the file system is mounted, let’s just do a simple “ls” to check that we can access the data.

laytonjb@laytonjb-laptop:~$ ls -s SSHFS_TEST
total 44
24 configure.wrf   4 example_woodcrest  16 Makefile

The remote system has just a few files, but I can easily access them by any application that is POSIX compliant. For example, I could use “vi” to edit the file or I could use the normal command line tools, “cp”, “ls”, “mv”, “rm”, etc., to manipulate the files.

As you can see, it’s pretty easy to use SSHFS. Once it’s installed mounting remote file systems is fairly easy for any user to accomplish using their own home account.

There are a huge number of articles describing how to setup SSHFS and how it can be used. Remember that SSHFS is based on ssh so there are a number of articles on how to configure ssh to not require passwords during mount. For example, there is a good article on how to configure PAM (Pluggable Authentication Modules) and SSHFS to not use ssh passwords.

Perhaps somewhat surprisingly there are a number of article about using SSHFS as part of a backup process. For example, this article talks about how to automate backups using SSHFS.

Another group of articles is how to use SSHFS with Windows for mounting Windows volumes. For example, this article explains how to mount remote Windows volumes on Linux desktops.

But one thing to remember about SSHFS is that it uses ssh underneath so do not expect good performance from it. For example, it can be appealing to replace nfs with SSHFS since users can mount remote file systems very easily, perhaps even in HPC systems. But ssh will have to encrypt the data before sending it and then decrypt it on the receiving side, using CPU cycles and reducing throughput. But if performance is perhaps not the primary motivation for SSHFS then it is definitely something worth considering.


SSHFS was the first userspace file system I used. Years ago it allowed me to mount remote file systems on my desktop so I could easily copy, edit, and manipulate the files. It was a wonderful tool that made my life easier by far and I still use it today.

SSHFS is very easy to configure once FUSE is configured and installed. Most distributions today already have FUSE configured and installed so that usually isn’t a problem. But if you build your own kernels like I tend to do, you will need to make sure that FUSE is configured.

SSHFS is just one wonderful example of a user-space file system based on FUSE. If you have a remote file system you need to access then SSHFS is the way to go.

Comments on "Cool User File Systems, Part 1: SSHFS"


Thanks for this. I had a project where I only had sftp access (no ssh access) to the previous site/server, and with this little trick I could still grab a nice mirror. An excellent little trick to keep up my sleeve!


When should this be used?

How does this compare to something like an sftp connection using nautilus?

How stable is this, how volatile is my data? Would I ever use this for more than small remote edits, and file transfers?

Is KDEs KIO, better to use in this regard?

Would nfs over a ssh tunnel be any better or worse?

What goes on behind the scenes with these user file systems?


@grabur: sshfs uses sftp underneath, so AFAIK it is as stable as nautilus’ sftp connection. The nice thing is that files appear transparent, like “locally mounted” and is accessible via regular path names. I don’t think that can be done with nautilus sftp mounting. Don’t know how this would compare to nfs over ssh. The down side with sftp is that once the connection drops, the mounting is gone (since there is no keep-alive server on the remote side). And if you are still in the I/O process while the connection is gone, you are in trouble. I have experienced this. This is definitely a concern with wireless connection. But I have been using sshfs many times to access files remotely conveniently.


@wirawan0 thanks for that.

Guess what I’d worry about is what happens precisely if a connection drops out.

I use sftp to mount vms, and nautilus integration is very nice. So much that I get frustrated when it’s not there. Nautilus/gnome file system handling feels like a black box to me. Mounting a file system feels more intuitive I have to say, I like file access from the shell.


{Salut|Noroc|Hello} {Belele|Probleme}Balarii|Dude} cu cabluri de retea {au fost|sunt} si or sa tot fie. Important e cum le rezolvi :p


My brother suggested I may like this website. He was totally right. This put up actually made my day. You cann’t believe simply how much time I had spent for this information! Thanks!


Hey there are using WordPress for your site platform? I’m new to the blog world but I’m trying to get started and create my own. Do you need any coding expertise to make your own blog? Any help would be greatly appreciated!


Hello. splendid job. I did not imagine this. This is a impressive story. Thanks!


Thanks so much for the blog post.Really thank you! Want more.


certainly like your web site but you have to check the spelling on several of your posts. A number of them are rife with spelling problems and I find it very troublesome to tell the truth nevertheless I will definitely come back again.


One of our guests a short while ago advised the following website.


I have been surfing online more than 3 hours today, yet I by no means found any interesting article like yours. It’s lovely price sufficient for me. In my opinion, if all website owners and bloggers made good content material as you probably did, the web will be a lot more useful than ever before. “It’s all right to have butterflies in your stomach. Just get them to fly in formation.” by Dr. Rob Gilbert.


I believe this website holds some real wonderful info for everyone :D. “Calamity is the test of integrity.” by Samuel Richardson.


q8PQIe Wanted to drop a remark and let you know your Feed isnt working today. I tried including it to my Google reader account but got nothing.


We came across a cool web page that you could delight in. Take a appear for those who want.


Usually posts some extremely intriguing stuff like this. If you?re new to this site.


Excellent post. I was checking continuously this blog and I am impressed! Very helpful information specifically the last part :) I care for such information a lot. I was seeking this particular info for a long time. Thank you and best of luck.


Modish bare pictures
free erotic erotic chatbot erotics erotic horror movie good erotic movies


That is the finish of this article. Right here you will find some internet sites that we feel you?ll appreciate, just click the hyperlinks.


Every after inside a while we pick out blogs that we read. Listed beneath are the most up-to-date websites that we pick out.


Here are some hyperlinks to web-sites that we link to simply because we believe they may be really worth visiting.


Always a significant fan of linking to bloggers that I enjoy but really don’t get a great deal of link love from.


We prefer to honor a lot of other web sites on the internet, even though they aren?t linked to us, by linking to them. Under are some webpages worth checking out.


We came across a cool web-site which you could love. Take a look when you want.


We prefer to honor a lot of other net sites on the internet, even when they aren?t linked to us, by linking to them. Underneath are some webpages really worth checking out.


Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>