Mount remote directories with SSHFS

Introduction

For those who don’t know, SSHFS stands for Secure SHell FileSystem. It’s a client that enables us to interact with remote directories through SFTP (SSH File Transfer Protocol).
This is a secure file transfer protocol that provides file access, file transfer and file management features over SSH. We’ll install it on a Red Hat based distro.

Install SSHFS Client

First, you need to enable epel-repository. Then, just use yum:

# yum install sshfs

Create a mount point and mount an FS

You must create a mount point directory where you will mount your remote file system. For example on /mnt/sshfstest. Of course, use the mount point you want or need.
Now, you can mount a remote directory under /etc/sshfstest.

# sshfs -o IdentityFile=~/.ssh/id_rsa hostname@X.X.X.X:/remote/directory /mnt/sshfstest
Check mount point

To test, check if the commands above made their jobs. For instance, you can use df.

# df -hT

Conclusion

That’s all, now you have mounted your remote directory. If you want, you can do this permanently editing the /etc/fstab file.