How to Install and Use SSHFS
SFTP provides secure file transfer and a secure remote file system. While SFTP clients may transfer files and directories, the related file system may not be mounted locally using SFTP alone. Using SSHFS, a remote file system may be treated in the same way as other volumes (such as CDs, DVDs, USB flash drives and shared disks)
Install SSHFS with yum
Use the following command to install the SSHFS package with yum:
yum install fuse-sshfs
If you are not able to install using yum then download and install the latest and stable version of the source file from below link.
Now extract the folder by using the following command:
tar -xvf sshfs-3.0.0.tar.gz
You have to enter the folder with “cd” and then use configure and compile SSHFS:
make && make install
Now let’s start using SSHFS as it’s successfully installed. Make a folder that you want to share with client end. Let’s suppose we make a folder in /var/ with name “mnt”
Mount remote SFTP folder as drive
My remote server IP is 192.168.5.11 and remote folder is “/home/hitesh/share/”
sshfs firstname.lastname@example.org:/home/hitesh/share/ /var/mnt
Now we will check that is this folder mounted and you can see files or not?
[root@sudoadminmain ~]# cd /var/mnt/ [root@sudoadminmain mnt]# ls
This is a temporary mount that will be automatically unmounted when you restart the server. If you want a persistent mount then you should add the mount in /etc/fstab or add the mount command into the /etc/rc.local file which gets run at boot.
Unmount a remote folder
You can unmount the folder by using the following command on your server
[root@sudoadminmain mnt]# umount /var/mnt
Above installation and setup is verified on Centos 6,7.