Mount a remote filesystem via sshfs

sshfs is a file system client based on the SSH File Transfer Protocol. Since most SSH servers already support this protocol it is very easy to set up: i.e. on the server side there’s nothing to do. On the client side mounting the file system is as easy as logging into the server with ssh.

Install SSH Server:

sudo apt-get update
sudo apt-get install ssh

NOTE: Throughout this part of the tutorial, always replace username with your server’s username, and host with the IP Address or domain of your server.

Test your SSH connection to the server:

ssh username@host

If your connection was successful move on to the next step

Install sshfs:

sudo apt-get update
sudo apt-get install sshfs
sudo modprobe fuse

Configure your user to be a member of the FUSE group:

sudo adduser username fuse
sudo chown root:fuse /dev/fuse
sudo chmod +x /dev/fuse

Because a new user group has been created, we must now logout and back into the system. A reboot is not required.

When you have logged back in, we need to create a mount point within your home folder. It is important to note that the mount point must be within a folder owned by your user, so the safest place to put the mount point will be in your home directory.

mkdir ~/what_ever_you_like_to_call_this_directory

Let’s mount and test the remote file system:

sshfs username@host:/remote/dir/to/mount ~/what_ever_you_like_to_call_this_directory/

Now if all is successful you remote directory should be mounted. You should be able to type ls -lg in terminal or use you favorite file manager like nautalus to view the remote server mount point.

To unmount the remote file system:

fusermount -u ~/what_ever_you_like_to_call_this_directory/

Leave a Reply