How to Mount Remote Linux Filesystem or Directory Using SSHFS Over SSH
============================
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.
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.
In this article, we will show you how to install and use SSHFS client on any Linux distribution to mount remote Linux filesystem or directory on a local Linux machine.
#### Step 1: Install SSHFS Client in Linux Systems
By default sshfs packages does not exists on all major Linux distributions, you need to enable [epel repository][1] under your Linux systems to install sshfs with the help of Yum command with their dependencies.
```
# yum install sshfs
# dnf install sshfs [On Fedora 22+ releases]
$ sudo apt-get install sshfs [On Debian/Ubuntu based systems]
```
#### 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
$ sudo mkdir /mnt/tecmint [On Debian/Ubuntu based systems]
```
### 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).
If your Linux server is configured with SSH key based authorization, then you will need to specify the path to your public keys as shown in the following command.
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
$ sudo vi /etc/fstab [On Debian/Ubuntu based systems]
```
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.
Next, you need to update the fstab file to reflect the changes.
```
# mount -a
$ sudo mount -a [On Debian/Ubuntu based systems]
```
#### 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’s all for now, 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.