User Tools

Site Tools


how_to_use_sshfs_to_mount_anything

How to use SSHFS to mount anything

SSHFS ("SSH File System") is a system to let you mount anything on any machine that you can SSH to. To use it on Ubuntu:

$ sudo apt-get install sshfs
$ sudo adduser <your_userid> fuse

You can install it on RHEL5/CentOS5 these directions. You don't even have to be root to use it (provided you are in the 'fuse' group, or you "chmod 777 /dev/fuse").

register$ mkdir mntpoint
register$ sshfs break:/ mntpoint
register$ ls mntpoint
 a    boot  etc   initrd  lib64       media  mnt  opt               proc  sbin     srv  t    u    var
 bin  dev   home  lib     lost+found  misc   net  post-changes.tar  root  selinux  sys  tmp  usr  x
register$ echo something > mntpoint/etc/yp.conf
 bash: mntpoint/etc/yp.conf: Permission denied

Neat, but what if we want root access to that system? Well, you can do:

register$ sshfs root@break:/ mntpoint

You'll need the root password to that last bit.

You can go all crazy and mount a bunch of stuff at once:

pac00# for A in `seq 0 9`; do mkdir pac0$A ; sshfs pac0$A:/ pac0$A ; done

That will make a directory for pac00 .. pac09 and mount that system's root there. Then you could go nuts with some scripts to modify each system.

Because this works on any system you can SSH to, it cuts through NAT routers and firewalls, and you can mount almost any OS, including:

  • Linux
  • VMWare ESX
  • Solaris
  • FreeBSD
  • Mac OS X
  • Windows (if you've installed an SSH server like Cygwin)
how_to_use_sshfs_to_mount_anything.txt · Last modified: 2010/12/03 23:27 by tkbletsc