Endorsement of a wonderful tool: SSHFS
peter.garrett at optusnet.com.au
Thu May 21 22:46:05 BST 2009
On Thu, 21 May 2009 19:06:37 +0100
David Gerard <dgerard at gmail.com> wrote:
> 2009/5/21 Brian Fahrlander <wheeldweller at gmail.com>:
> > David Gerard wrote:
> >> Modulo the minor problem that sshfs doesn't seem to cope with or
> >> auto-reconnect when the laptop suspends and comes back. Has anyone a
> >> workaround for this that isn't ridiculous? (I could trigger a resume
> >> script to do a lazy unmount and remount, but that feels silly. There
> >> *should* be a better way.)
> > Well now, I remembered something about a keepalive setting, but when I'd
> > finally made it to 'the promised land' of SSHFS, I quit reading the details.
> > Perhaps that's what that's about?
> No, that's for keeping alive an existing connection - it doesn't
> appear to restore it after the laptop's been suspended long enough to
> break it.
> (In this regard, SMB wins because the connection is made afresh every
> time you try to fetch a file. But smbfs seems to have the same
> suspending problem as sshfs.)
I think "afuse" will survive suspend (I just tried it here and it
appears to do so). It's a user-space implementation of autofs.
I just came across it a few days ago. There's a pretty straightforward
run-through on using it here:
For each "managed directory" you issue one command as explained at that
link. I imagine you could write the command(s) into a start-up script
for your window manager or desktop environment, for example, or just
set up an alias to start your desired sshfs mounts. Obviously a script
would need to check that the machine was on the network before issuing
the initial commands.
Something on the lines of:
afuse -o mount_template="sshfs %r:/ %m" \
-o unmount_template="fusermount -u -z %m" ~/sshfs/ \
&& ls sshfs/user at host
Will give you the idea.
"Afuse" is in the Ubuntu and Debian repos.
It allows you to set up an "afuse" mount point, for example in your home
dir, and when you 'cd' or 'ls' to, say ~/sshfs/user at host, you are
"there". New directories are created for each connection, with name
"user at host", and persist until you issue
fusermount -u -z ~/sshfs/
(of course, you can make a directory with a
different name, or set up a number of directories to be managed, and so
on. You can also symlink subdirectories of the mount point as
"shortcuts", or presumably do any of the usual things that can be done
on your local filesystem.)
My (very brief) test shows the functionality surviving suspend/resume
here on my iBook G4 running Debian and Ubuntu dual boot...
YMMV, and HTH, as they say... ;)
"INX Is Not X" Live CD based on Ubuntu 8.04 : http://inx.maincontent.net
Screenshots slideshow: http://inx.maincontent.net/album/1.png.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/sounder/attachments/20090522/bf985e1a/attachment-0001.pgp
More information about the sounder