SSHFS  Howto

In my previous blog post I explained how to use two different types of secure data transfer between two hosts on the Internet. FTPs is an extension of the insecure FTP protocol which adds support for Transport Layer Security (TLS) or the former Secure Socket Layer (SSL). It requires a working FTP server and a range of open ports on the server for the data and control channel.

sFTP, on the other hand, uses only one port for all the communications. Hence it is easier to secure. It utilizes the already installed SSH server and both Windows and Linux sFTP clients are very intuitive and easy to use.

While everybody would recommend using sFTP, because it is easier to setup and more secure, I would like to suggest another solution that utilizes a SSH server. Secure Shell Filesystem (SSHFS) is a convenient and secure way to access your remote files using SSH. With the help of SSHFS you can browse, read, write and modify any file or directory on the remote host as if it stored on your local computer. You can cut down on the hustle and bustle of uploading all the files on the remote server every time you make a change.

How to Set Up Secure Shell File System Connection

Setting up a secure shell file system depends on your workstation operating system.

SSHFS For Linux

The sshfs command is a client tool for using SSHFS to mount a remote file system from another server locally on your machine over secure shell protocol. On a Debian / Ununtu workstation you will need to use apt-get command to install the command.

$ sudo apt-get install sshfs

On a RedHatbased Linux Distributions like Cent OS, you can install it with yum command:

sudo yum install sshfs

Mount Remote FileSystem

After installing the sshfs package, it is time to mount the remote file system. The good thing is, you don’t need a super user account to use the command. Mileage may vary according your needs. In this tutorial I am mounting a remote directory in my user’s home folder. The user should be able to access the directory in order to be able to mount it. First, let’s create a mounting point in my home directory. The following set of commands will create a mounting folder in your home directory. After that sshfs command will login you in the remote_host as a remote_user.

$cd
$mkdir mnt
$sshfs remote_user@remote_host_ip:/remote_directory/ ~/mnt/

Unmount Remote Filesystem

Unmount the remote filesystem using the standard umount tool. First exit the filesystem at tge ~/mnt/ directory and then enter the following:

$umount ~/mnt/

Leave a Reply

Your email address will not be published.