sshfs: How do you install sshfs and fuse? [CentOS/Linux/Redhat]

One may wonder what is sshfs and why would you want it?  Well simply put, sshfs allows you to mount another server’s filesystem into a folder on your local system which in the background is doing ssh commands and transfers.  As a mounted folder, you are able to move about and copy files back and forth as everything was on local server.  As you can see this makes it very easy for you to work with files on multiple servers.

Note:  you only have to do the following installations on the server where you are doing the mounts on.

Let us download and install the filesystem framework which is a requirement for sshfs called fuse.

tar zxpfv fuse-*.gz
cd fuse*

If you get the following error, you will either have to point to the location of the kernel source or install it if needed.

checking kernel source directory... Not found
configure: error:
*** Please specify the location of the kernel source with
*** the '--with-kernel=SRCDIR' option
configure: error: ./configure failed for kernel

In our case here, we will be installing the source using yum.

yum -y install kernel-devel

Once installed, you will have to find out the directory it is installed in

ls -l /usr/src/kernels/
total 4.0K
drwxr-xr-x 18 root root 4.0K Oct  7 14:50 2.6.18-92.1.13.el5-x86_64/

./configure --with-kernel=/usr/src/kernels/2.6.18-92.1.13.el5-x86_64
make && make install
cd ..

Now let us get sshfs source and install it.

tar zxpfv sshfs*
cd sshfs-fuse-*

If you get the following error:

checking for SSHFS... configure: error: The pkg-config script could not be found or is too old.  Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.


checking for SSHFS... configure: error: Package requirements (fuse >= 2.2 glib-2.0 gthread-2.0) were not met:

No package ‘glib-2.0′ found
No package ‘gthread-2.0′ found

You need to install glib2.  Do the following:

yum install glib2-devel

Once installation is done, continue with configure.

make && make install

After installation is done, we can move on with testing the installation:

cd /mnt
mkdir test
sshfs test

If you get the following error,
sshfs: error while loading shared libraries: cannot open shared object file: No such file or directory
execute this: NOTE: this is for x64 system. If you have 32 bit system, you have to symlink to /lib instead.
ln -s /usr/local/lib/ /lib64/
Let us try mounting again:
sshfs test
At this point it would be like if you were making a ssh connection to You will have to type in a password to get the mount to happen. You may get the following error: fuse: device not found, try 'modprobe fuse' first

If you do ‘modprobe fuse’, as they tell you to, and you get:
modprobe fuse
FATAL: Module fuse not found.

That means your running kernel is not the same version as the one you compiled with. You have two options here:
1) you can upgrade your kernel by typing: yum update kernel
2) find the source files for the kernel you have running and recompile fuse.

I went with option 1. Once you do the update, reboot and try doing modprobe fuse again.

At this point we can try doing the mount again.
cd /mnt
sshfs test

If you do not get any errors, do df -h to see the mount:
sshfs# 1000G 0 1000G 0% /mnt/test

At this point you can browse server filesystem as it was local on your server.


DISCLAIMER: Please be smart and use code found on internet carefully. Make backups often. And yeah.. last but not least.. I am not responsible for any damage caused by this posting. Use at your own risk.

14 thoughts on “sshfs: How do you install sshfs and fuse? [CentOS/Linux/Redhat]

  1. Roberto

    Very similar procedure in Debian/Ubuntu… :-)

    apt-get install sshfs
    cd /mnt
    sshfs test

  2. cedric maire

    Thank you for this howto, this is perfect for RHEL 5.3 64 bits

    It has been pain to find out, but this is the one procedure that works! Downloading the RPMs for fuse and fuse-ssh and installing them do not work (you get the “modprobe fuse” issue which I couldn’t get around)

    Getting the latest sources for fuse and fuse-ssh (using sourceforge in my case), as well as creating a couple of symbolic links (especially for the library), and it worked like a charm!

    Again, thank you, even though it would have been better for the RPMs to work out of the box from an update point of view.

    NOTE: installing the packages via YUM works with Fedora, I am guessing it is dependant on the fact that fuse has been integrated to later kernels than the one used by RHEL.

  3. DeAngelo

    Thaaaaaaaaaaaank you. I’m so impressed with every step. Normally howto’s leave you stuck in the middle.

  4. Pingback: Mount remote filesystem via ssh protocol using sshfs and fuse « Tournas Dimitrios

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>