[Hampshire] automating sshfs

Top Page

Reply to this message
Author: Paul Tansom
Date:  
To: hampshire
Subject: [Hampshire] automating sshfs
I'd better clarify that subject a bit. I'm quite happy with configuring fstab
to automatically mount a filesystem, using keys to ease the authentication and
a keepalive in ~/.ssh/config to keep the connection active. What I'm looking
for is an automated means of reconnecting if the connection is lost for some
reason.

Basically the intention is to have directories mounted between machines to
enable occasional file transfer between sites (without the need for separate
file transfer software), but some of the machines are shutdown over night, so
the connection needs to be re-established if that happens (so a file isn't put
in the local version of the mount directory by mistake), or if the ADSL
connection is lost.

At the moment I'm expecting to work with something along the lines of a short
script that is run from the mounted directory. If the mount is active then the
script at the remote end does nothing, if not then the version in the local
directory will re-establish the mount. Obviously I need to be careful with
security here, so will probably call the script from within another that does a
checksum before running it (just to be safe).

This all relies on a regular and frequent cron job, so I've been looking for
something a bit more elegant. Either I've not found the right search terms for
this (I usually come up with solutions relating to the keepalive functionality
of SSH), or this isn't something that's been a major consideration for Fuse or
sshfs.

Has anyone got any alternative suggestion?

--
Paul Tansom | Aptanet Ltd. | http://www.aptanet.com/ | 023 9238 0001
======================================================================
Registered in England | Company No: 4905028 | Registered Office:
Crawford House, Hambledon Road, Denmead, Waterlooville, Hants, PO7 6NU