Linux

Mounting remote directory using sshfs

SSHFS

SSHF provides a secure way to access remote machines on the fly via the Secure Shell File Transfer Protocol (SFTP). It stands for Secure Shell File System and it is a software developed for use on Linux distributions.

HOW TO USE SSHFS


1: Download and install the fuse-sshfs package

Furthermore, The SSHFS package is not included in any of the repositories on the Linux Operating System. You will have to download the rpm package for fuse-sshfs to your machine or you can use the yum command if you have access to an online repository.

After downloading the rpm package, go to the terminal of the local machine, migrate to the directory that has the downloaded package and then use the rpm command to install the rpm package for the sshfs

Remote directory mounting
For the purpose of this demonstration I have created a directory “test” in the remote machine
File system
In that directory is a text file “testfile” that says “This is a test file to demonstrate SSHFS

2: Create a mount point on the local machine
– On the machine where the SSHFS is installed, log in as root and create a mount point. I am going to call mine server22 and an ll command on that directory should show it is empty.

SSH-based file access

3: Mount the remote directory on the local machine
– Now mount the remote directory with the syntax

sshfs remote-machine-name@ip-address:directory-path /mount-point

It should ask you for the password of the remote machine when you hit the enter button. Input the required password.

Now migrate to the mount point/directory, and do the “ll” command; if all is well, you should see the files in the mounted directory of the remote machine.

Most servers already support this protocol it is very easy to set up. On the client-side mounting, the file-system is as easy. We don’t have to do much configuration on the server-side. All you need is the remote server should have a working SSH server.

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x