Did You Know?
Donate to TecMint

LFCS - Linux Foundation Certified SysAdmin - Exam Preparation Guide

SSHFS (Secure SHell FileSystem) for Mounting Remote Linux Filesystems

Download Your Free eBooks NOW - 10 Free Linux eBooks for Administrators

The main purpose of writing this article is to provide a step-by-step guide on how to mount remote Linux file system using SSHFS client over SSH. This article is useful for those users and system administrators who want to mount remote file system on their local systems for whatever purposes. We have practically tested by installing SSHFS client on one of our Linux system and successfully mounted remote file systems. Before we go further installation let’s understand about SSHFS and how it works.

Install SSHFS in Linux

Install SSHFS in Linux

What Is SSHFS?

SSHFS stands for (Secure SHell FileSystem) client that enable us to mount remote filesystem and interact with remote directories and files on a local machine using SSH File Transfer Protocol (SFTP). SFTP is a secure file transfer protocol that provides file access, file transfer and file management features over Secure Shell protocol. Because SSH uses encryption while transferring files over the network from one computer to another computer and SSHFS comes with built-in FUSE (Filesystem in Userspace) kernel module that allows any non-privileged users to create their file system without modifying kernel code.

Before we move further with the installation process, We’d like to tell you that the below installation also works on all RedHat based distributions like RHEL 6.3/6.2/6.1/6/5.8, CentOS 6.3/6.2/6.1/6/5.8 and Fedora 17,16,15,14,13,12.

Install SSHFS in RHEL, CentOS and Fedora

Step 1: Installing SSHFS

By default sshfs packages does not exists on all major Linux distributions, you need to enable epel repository under your Linux systems to install sshfs with the help of Yum command with their dependencies.

# yum install sshfs

Step 2: Creating SSHFS Mount Directory

Once the sshfs package installed, you need to create a mount point directory where you will mount your remote file system. For example, we have created mount directory under /mnt/tecmint.

# mkdir /mnt/tecmint

Step 3: Mounting Remote Filesystem with SSHFS

Once you have created your mount point directory, now run the following command as a root user to mount remote file system under /mnt/tecmint. In your case the mount directory would be anything. The following command will mount remote directory called /home/tecmint under /mnt/tecmint in local system. (Don’t forget replace x.x.x.x with your IP Address and mount point).

# sshfs tecmint@x.x.x.x:/home/tecmint/ /mnt/tecmint

Step 4: Verifying Remote Filesystem is Mounted

If you have run the above command successfully without any errors, you will see the list of remote files and directories mounted under /mnt/tecmint.

# cd /mnt/tecmint
# ls
[root@ tecmint]# ls
12345.jpg                       ffmpeg-php-0.6.0.tbz2                Linux                                           news-closeup.xsl     s3.jpg
cmslogs                         gmd-latest.sql.tar.bz2               Malware                                         newsletter1.html     sshdallow
epel-release-6-5.noarch.rpm     json-1.2.1                           movies_list.php                                 pollbeta.sql
ffmpeg-php-0.6.0                json-1.2.1.tgz                       my_next_artical_v2.php                          pollbeta.tar.bz2

Step 5: Checking Mount Point with df -hT Command

If you run df -hT command you will see the remote file system mount point.

# df -hT
[root@tecmint]# df -hT
Filesystem			Type    Size  Used Avail Use% Mounted on
/dev/cciss/c0d0p2	ext3     75G   21G   51G  29% /
/dev/cciss/c0d0p5   ext3     24G   21G  1.5G  94% /home
/dev/cciss/c0d0p3   ext3     29G   25G  2.6G  91% /data
/dev/cciss/c0d0p1   ext3    289M   22M  253M   8% /boot
tmpfs				tmpfs    252M    0  252M   0% /dev/shm
sshfs#midday@ fuse 457G 129G 305G 30% /mnt/tecmint

Step 6: Mounting Remote Filesystem Permanently

To mount remote filesystem permanently, you need to edit the file called /etc/fstab. To do, open the file with your favorite editor.

# vi /etc/fstab

Go to the bottom of the file and add the following line to it and save the file and exit. The below entry mount remote server file system with default settings.

sshfs#tecmint@x.x.x.x:/home/tecmint/ /mnt/tecmint fuse defaults 0 0

Next, you need to update the fstab file to reflect the changes.

# mount -a

Step 7: Unmounting Remote Filesystem

To unmount remote filesystem, jun issue the following command it will unmount the remote file system.

# umount /mnt/tecmint

That’it here we are ending this article, if you’re facing any difficulties or need any help in mounting remote file system, please contact us via comments and if you feel this article is much useful then share it with your friends.

Ravi Saive

Owner at TecMint.com
Simple Word a Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux.

Your name can also be listed here. Work as a Paid freelancer/writer at TecMint.
Download Free eBooks
Advanced Bash-Scripting Guide
Linux Bible
A Newbie's Getting Started Guide to Linux
Ubuntu Linux Toolbox: 1000+ Commands

10 Responses

  1. David says:

    Hi, using default installed CENTOS 6.3 ..

    # yum install sshfs
    Loaded plugins: fastestmirror, refresh-packagekit, security
    Loading mirror speeds from cached hostfile
    * base: http://ftp.telus.net
    * extras: http://ftp.telus.net
    * updates: http://ftp.telus.net
    Setting up Install Process
    No package sshfs available.
    Error: Nothing to do

    • Ravi Saive says:


      Sorry, the article is updated now, you just need to enable epel repository under your centos 6.3 to install sshfs.

  2. hi..!! im geting this error when trying to mount

    fuse: failed to open /dev/fuse: Permission denied

    OS Centos 6 64 bits

  3. Shameek Bhattacharya says:

    Works well with Ubuntu 13.04 too

  4. Yaniv says:


    What about if my user name at the FTP is user@email.com
    how to set it up?

  5. jakarta87 says:

    Very nice and friendly guide! Easy to do!

  6. Alex says:


    What about to keep Alive? I use that and work propertly but sometimes the conection is broken but not reconnect automatically. Can you help me with that?


  7. Jaredis says:

    Only root has read rights after mounting, so not even root’s crontab can read those files. How do you mount readonly, all-users can access?

Leave a Reply

This work is licensed under a (cc) BY-NC | TecMint uses cookies. By using our services, you comply to use of our cookies. More info: Privacy Policy.
© 2012-2014 All Rights Reserved.