twitter

How To's Tutorials

SSHFS(Secure SHell FileSystem): Securely Mount remote filesystem over ssh

Overview :

 

In Linux like operating system we can securely mount remote filesystem over ssh  protocol  using sshfs command. SSHFS stands fro Secure SHell FileSystem. SSHFS enable us to mount remote filesystem and interact with remote directories and files on a local machine.

 

On  the local computer where the SSHFS is mounted, the implementation makes use of the FUSE (Filesystem in Userspace) kernel module. The practical effect of this is that the end user can seamlessly interact with  remote  files  being  securely served  over  SSH  just  as if they were local files on his/her computer. On the remote computer the SFTP subsystem of SSH is used.

 

Installation of SSHFS on CentOS 6.X / RHEL 6.X / Fedora

 

As sshfs package is not available in the default repositories, so first enable the epel repository and then use yum command to install sshfs .

 

# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm
# yum install sshfs

 

Installation of SSHFS on Ubuntu

 

#  sudo apt-get install sshfs

 

 

Mount the Remote File System using below command .

 

Syntax :

# sshfs [user@]host:[dir] mountpoint

 

 

Example :

 

[root@mail11 ~]# sshfs root@mail9.nsitmail.com:/  /home/nextstep4it/

 

In the above command we are mounting  " / " filesystem of remote host(mail9.nsitmail.com) on local the folder (/home/nextstep4it). Verify the whether remote filesystem is mounted or not using command (df -hT)

 

SSHFS(Secure SHell FileSystem)

 

 

Permanently Mount Remote Filesystem

 

When we mount remote filesystem using sshfs, and for some reasons if your local machine gets rebooted, then after reboot remote filesystem will not be available, so to permanently mount remote filesystem, add the below entries in the /etc/fstab file.

 

root@mail9.nsitmail.com:/  /home/nextstep4it/   fuse defaults 0 0

 

Now run below command to reflect the changes of fstab file

 

# mount -a

 

To Umount the Remote File system, use Below command :

 

# umount /home/nextstep4it

 

OR

 

# fusermount -u mountpoint

 

Himanshu on, 2013-11-12 12:19:20
Great!!
Leo G on, 2013-11-14 13:31:18
What if the connection breaks or is interupted
Bob Robertson on, 2013-11-14 14:25:55
Sshfs works across to any system reachable by ssh, be it remote web server or local backups. The reason I first found sshfs was for remote storage. Scp has one unstoppable problem: It follows simlinks. When trying to back up a users entire directo
Post Your Comments
Name:
Email:
Comment:
Security Code  *
Enter Security Code  *
Can't read the image? click here to refresh