Tip of the Trade: Easy and Secure Remote Editing

By Carla Schroder (Send Email)
Posted Jan 15, 2007


Using ssh for remote administration on Linux systems is easy and secure. But if you have multiple files to edit, it can get a bit cumbersome juggling multiple terminals. If you have a lot of files to edit, or large complex files, you can tunnel X Windows over ssh and use graphical file managers and editors. But this still isn't ideal, because it lags over slow connections. So there is a third option that gives you both the environment of your choice and speed: sshfs. Use sshfs to mount an entire remote filesystem on your local PC, so you can edit and use it just like a local filesystem. It's way easier than using a network filesystem like Samba or NFS.

Discuss this article in the ServerWatch discussion forum

sshfs mounts the entire remote filesystem on your local PC, so you can edit and use it just like a local filesystem. It's way easier than using a network filesystem like Samba or NFS, because there are no shares to configure. As long as your kernel already supports FUSE (Filesystem In Userspace), all you need to do is install the userland tools sshfs and fuse-utils.

Check for kernel support by looking in your /boot/config-[version] file. You want to see "CONFIG_FUSE_FS=m". If it says "# CONFIG_FUSE_FS is not set" then you need to rebuild your kernel. It's unlikely you'll have to do this, since it's standard in most Linux distributions.

After installing sshfs and fuse-utils, follow these steps:

  • Have an SSH server running on your remote PC
  • Create a mountpoint that you have permission to access, like a subdirectory in your home directory
  • Create the fuse group and add yourself to it
  • Log completely out, then log back in again
Load the fuse kernel module by running the modprobe fuse command as root. Now you can mount a remote filesystem with one command:
$ sshfs hostname:/remotedir localdir/
hostname:/remotedir is the hostname of your remote PC and the directory you want to mount, and localdir is your local mountpoint. You must have permissions to use both directories, and you need an account on the remote PC. sshfs will authenticate you just like any ssh login. When you're finished, unmount with the fusermount -u localdir/ command. For more information, visit fuse.sourceforge.net.

Page 1 of 1


Comment and Contribute

Your name/nickname

Your email

(Maximum characters: 1200). You have characters left.