Mount a Remote File System with SSHFS on CentOS 6

Last Updated: Wed, Sep 2, 2015
CentOS System Admin
Archived content

This article is outdated and may not work correctly for current operating systems or software.

Many system administrators manage large amounts of servers. When files need to be accessed across different servers, logging into each one individually can become quite tedious. It would be much easier if the files were accessible from a single system. The SSHFS software is a great fit for this use case.

In addition to being able to mount file systems, SSHFS was created so that it could run without having root privileges. This is possible through the Fuse library (filesystem in userspace). You will still need root privileges to install SSHFS though.

Please note: The system that's used to access the remote file system must be using the Xen/KVM virtualization platforms, or OpenVZ, with the provider enabling Fuse for you.

Let's get started, shall we?

Step 1 - Enabling the kernel module

This is a simple step - all you need to do is run the following command as the root user:

modprobe fuse

Step 2 - Installing Fuse/SSHFS

To install Fuse/SSHFS, we first need to enable the EPEL (Extra Packages for Enterprise Linux) repository. Execute the following command as the root user, again:

yum install epel-release

That will enable the EPEL repository. Now, let's install Fuse and SSHFS.

yum install sshfs

Now that we have the software installation out of the way, let's get started with it.

Step 3 - Using SSHFS

The commands to use SSHFS are fairly simple. To mount a remote folder, use the following commands.

mkdir /testDirectory

sshfs root@my.remote.server: /testDirectory

The directory, /testDirectory, is where the remote servers' files are visible, and can be edited if the user on the remote server has permissions to do so.

It is possible to use a private key for authentication as well. If you use a private key, make sure that you've set proper permissions on the identity file.

sshfs root@my.remote.server: /testDirectory -o IdentityFile=/root/the.private.key

When finished, you can unmount the remote folder with this command.

fusermount -u /testDirectory


In conclusion, you should now have a basic knowledge of how to setup a remote mount point using only SSH and Fuse. Many users prefer SSHFS over other file sharing platforms like Samba, because SSHFS requires minimal configuration and is simpler to configure.

Want to contribute?

You could earn up to $600 by adding new articles.