Tuesday, December 14, 2010

Remote mount trough ssh - sshfs

You may need to work on remote hosts file systems and copying files over with scp/sftp may be a hassle. This is why sshfs is in place - you can mount remote file systems locally on your computer


How to do it (on ubuntu) - install first the sshfs


$ sudo aptitude install sshfs
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
The following NEW packages will be installed:
  sshfs
0 packages upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
Need to get 40.8kB of archives. After unpacking 143kB will be used.
Writing extended state information... Done
Get:1 http://ca.archive.ubuntu.com/ubuntu/ lucid/main sshfs 2.2-1build1 [40.8kB]
Fetched 40.8kB in 0s (44.3kB/s)
Selecting previously deselected package sshfs.
(Reading database ... 197354 files and directories currently installed.)
Unpacking sshfs (from .../sshfs_2.2-1build1_i386.deb) ...
Processing triggers for man-db ...
Setting up sshfs (2.2-1build1) ...
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Writing extended state information... Done


then is as easy as

$ mkdir /tmp/remote_host_name_yours
$ sshfs your_remote_host: /tmp/remote_host_name_yours
$ cd /tmp/remote_host_name_yours

that is it ! (you may be need to input a password or paraphrase)
to umount the remote file system you need to use


$ fusermount -u /tmp/remote_host_name_yours


for more info see http://fuse.sourceforge.net/sshfs.html