• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

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

by admin

In Linux like operating systems, we can securely mount a remote file system over ssh protocol using sshfs command. SSHFS stands for Secure SHell FileSystem. SSHFS enables us to mount the remote file system 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 (File system 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/RHEL/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 the below command.

Syntax:

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

Example:

# sshfs root@mail9.nsitmail.com:/  /home/thegeekdiary/

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

# df -hT

Permanently Mount Remote Filesystem

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

root@mail9.nsitmail.com:/  /home/thegeekdiary/   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/thegeekdiary

OR

# fusermount -u mountpoint

Filed Under: CentOS/RHEL, Linux, Ubuntu

Some more articles you might also be interested in …

  1. Linux OS Service ‘network’
  2. how to add a custom script to the systemd in CentOS/RHEL 7
  3. GoBuster: command not found
  4. “VDO Status: Out of space” – Error while creating a VDO disk
  5. lspci Command Examples in Linux
  6. Tutorial on Linux Clustering (High Availability)
  7. xeyes: command not found
  8. Understanding SELinux Booleans
  9. How to Enable Remote Desktop to Share the Current Desktop Session in CentOS/RHEL 7
  10. How to Restrict su Access to a User Only by PAM in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • qemu-system-x86_64: command not found
  • timedatectl: command not found
  • mpirun.openmpi: command not found
  • startkde: command not found

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright