Mounting A Remote File System Over SSH

When working with remote Linux servers, file transfer is a common scenario for developers. This doesn’t need to be a hassle. Secure andĀ convenient access to directories can be done with sshfs.

Installing SSHFS

Install sshfs with your favorite package manager.


sudo apt-get install sshfs


sudo pacman -S sshfs

CentOS/Red Hat

sudo yum install sshfs

win-sshfs is available from the Google Code Archive.

Mac will require FUSE as well as SSHFS and is available atĀ

Mounting The Remote File System

First create the local directory you would like to access the remote files from.

mkdir /pathto/somedirectoryname

Then mount with sshfs.

sshfs user@ip.address:/pathtoshare /home/user/directory/to/share/to

If you are using key authorization such as when connecting to a remote server like an Amazon EC2 instance, you will need to specify the full path of the key file with the IdentityFile option. Setting the allow_other option will be required as well.

sshfs user@ip.address:/pathtoshare /home/user/directory/to/share/to -o IdentityFile=/home/user/full/path/to/keyfile.pem -o allow_other

Unmounting The Remote File System

If you no longer need the mount point, the command to unmount is
sudo umount /pathto/somedirectoryname

Permanently Mounting A Remote File System

To have the mount persist across reboots, you will need to add the mount entry to the /etc/fstab file.
sudo vi /etc/fstab

Append another entry with the sshfs setting: /pathto/somedirectoryname

To load these settings, you can either reboot the machine or reload fstab mounts with the command

mount -a


The directory and their files will now be available locally as if they originated from your system. This will make file transfer and development a hassle free and much easier experience.

Leave a Reply