Nifty ssh tricks

I’m a sysadmin.  I use SSH all the time.  Lately I’ve been relying more and more on a couple of very nifty and very different SSH-related packages available through standard Ubuntu repositories for some time now.  The packages are: ClusterSSH and sshfs

SSHFS

sshfs, as the name suggests, is a filesystem view of an ssh connection.  That is, you can mount directories over ssh and treat them as though they are local filesystems.  sshfs uses fuse, so you need a relatively new kernel.  Anything from late 2006 or newer ought to do.

To install:

sudo apt-get install sshfs

To use:

sshfs username@host:/path/to/mount /mount/point/on/local/filesystem

Once mounted, you can cd to /mount/point/on/local/filesystem and voila, there are your files!  I used to use Konqueror’s fish:// for this all of the time, but this only worked with KDE apps.  sshfs is a much better general-case solution.  It seems to work pretty much flawlessly for me.

Next up, ClusterSSH

ClusterSSH was originally designed to ease the administration of clusters of Linux computers.  It uses PerlTK and Expect and can be used to simultaneously command multiple machines, with the added option of being able to take control of individual systems whenever needed.

To install:

sudo apt-get install clusterssh

To use (Basic case):

cssh host1 host2 host3 host4

Running this will open five windows:  Four terminals and a small command window.  To run the same command on all machines, click in the command window and type something.  To take command of a single machine, click in the terminal window for that machine.

You can define machine groups and perform other more advanced tasks with ClusterSSH.  Once installed, check out the man page for more details.  If man pages scare you, try this.

And that’s it for round one of my nifty ssh tricks.

Advertisements
%d bloggers like this: