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 with your favorite package manager.
sudo apt-get install sshfs
sudo pacman -S sshfs
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 https://osxfuse.github.io
Mounting The Remote File System
First create the local directory you would like to access the remote files from.
Then mount with sshfs.
sshfs firstname.lastname@example.org:/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 email@example.com:/pathtoshare /home/user/directory/to/share/to -o IdentityFile=/home/user/full/path/to/keyfile.pem -o allow_other
Unmounting The Remote File System
sudo umount /pathto/somedirectoryname
Permanently Mounting A Remote File System
sudo vi /etc/fstab
Append another entry with the sshfs setting:
To load these settings, you can either reboot the machine or reload fstab mounts with the command
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.