Setting up SSHFS
Last Updated: Mon, Mar 9, 2009What is SSHFS?
SSHFS allows you to conect to any host that supports SSH and mount the remote directory in your own local directory. This means you will be able to interact with the files as if they were on your own system and best of all the transactions are encrypted using SSH.
This is much faster, easier, and more effecient than using FTP. Some people are actually still using regular FTP to transfer files. The problem with FTP is that not only are your files sent in clear text but your username and password are also in plain sight for anyone to see.
If you are doing web development on a Linux machine, I suggest using this method over ftp to upload images and other content to your webhost or other remote machines.
The beauty of it as a server administrator is there are no additional usernames to setup or software to install. SSH is the only thing needed on the server side.
To get started open up your terminal and type the following command:
sudo apt-get install sshfs
Ubuntu/Debian users can use this link to install sshfs.
Once you have sshfs installed you can mount a share by using this command. Remember to replace the credentials and paths to your own.
sshfs [email protected]:/path/to/remote local/path
Some of you will find this command familiar as it is the same syntax used to copy files with scp.
When you are done with your work you can unmount the remote share with:
fusermount -u local_mountpoint
Advantages
SSHFS gives us a number of advantages. Anything you can do to local files can also be done on remote files thanks to SSHFS.
For example you could:
- Utilize local programs that the remote host doesn’t provide through SSH.
- Encrypt the remote files using local software and retain the ability to do incremental backups with rsync.
- Transfer the files securely