From: Vahis on
My intention is to serve a couple of directories continuously
to a friend. I've tested this using sshfs.

Everything runs fine when the mounts take place with the aid of
keys, manually and via scripts. So far so good.

But I'd need sshfs mounts on the client side to be remounted automagically
after dropping the connection for any reason.

That is, whenever the client connects to The Internet it mounts the
shares and after dropping connection the shares get mounted again as
soon as the connection is alive. Automagically, without user
intervention or even knowing about it.

This includes occasional drop outs (3G connection) as well as turning
off the client.

I have understood that this can be achieved with autossh.

What do I need to do on the server and what on the client to do that?

Vahis
--
"Sunrise 8:53am (EET), sunset 3:22pm (EET) at Espoo, Finland (6:29 hours daylight)"
http://waxborg.servepics.com
Linux 2.6.25.20-0.5-default #1 SMP 2009-08-14 01:48:11 +0200 x86_64
10:21am up 28 days 15:22, 12 users, load average: 0.35, 0.32, 0.26
From: Vahis on
On 2009-11-28, houghi <houghi(a)houghi.org.invalid> wrote:
> Vahis wrote:
>> My intention is to serve a couple of directories continuously
>> to a friend. I've tested this using sshfs.
>
> Think about security. Just saying.

I have another question about restricting user permissions in this.
I don't want to show my boobie collection to my wife's sister, do I?
>
>> Everything runs fine when the mounts take place with the aid of
>> keys, manually and via scripts. So far so good.
>>
>> But I'd need sshfs mounts on the client side to be remounted automagically
>> after dropping the connection for any reason.
>
> OK.
>
>> I have understood that this can be achieved with autossh.
>>
>> What do I need to do on the server and what on the client to do that?
>
> RTFM? ;-)

I actually have in some extent, can you imagine? :)
>
> http://linux.die.net/man/1/autossh
>
> However that only talks about ssh, not about sshfs. So I am not sure if
> autossh would do it.

I am asking this exactly for the same reason. I don't know either.

> You could try to write something similar for sshfs. However I think you
> do not even need to be so specifc with all the details.
> First I asume that no password needs to be enterd anymore when doing the
> sshfs connection.

Correct.
>
> #!/bin/bash
> # sshfsd (sshfs deamon)
> #re-connect sshfs
> CONNECT ()
> {
> sshfs user(a)server:/home/user ~/user_server
> }
> CONNECT
> #Test and reconnect
> x=1
> while [ $x == 1 ]
> do
> <some test connection where an output if given of OK or NOK>
> if [ $test == NOK ]
> then
> CONNECT
> fi
> sleep 60
> done
>
> This is just a draft of a basic idea. Some things you can add.
> 1. extenton to stop all (or some) sshfsd sessions and unmount the
> connections. This can be done by e.g. running ssshfs -d
>
> Well, that is a short list for things to add. ;-)
>
Thanks, I'll see if I can make it work with that somehow.
Another option might be vpn.

Vahis
--
"Sunrise 8:53am (EET), sunset 3:22pm (EET) at Espoo, Finland (6:29 hours daylight)"
http://waxborg.servepics.com
Linux 2.6.25.20-0.5-default #1 SMP 2009-08-14 01:48:11 +0200 x86_64
3:20pm up 28 days 20:21, 12 users, load average: 0.22, 0.20, 0.22
From: Bob Bob on
Hi Vahis

Perhaps I am not on the right track but would this be a candidate for
autofs? There seem to be many options for that although I admit I have
only used it for NFS and SMB.

I did however one run a PPP over SSH link many years ago. (Horrible
running TCP over TCP but it worked for the small amounts of shell/typing
that went on.) It had a keep alive that ran with a simple ping. ie ping
the remote host and if it isnt there establish the link. Not elegant by
todays standards but if you get caught with no quick solution this may do..

It was an every 1 minute cron job that didnt run if it saw itself. Most
of its time it spent sleeping. Like I said, horrible!

Cheers Bob

Vahis wrote:
> My intention is to serve a couple of directories continuously
> to a friend. I've tested this using sshfs.
From: David Bolt on
On Saturday 28 Nov 2009 14:34, while playing with a tin of spray paint,
Vahis painted this mural:

> On 2009-11-28, houghi <houghi(a)houghi.org.invalid> wrote:
>> Vahis wrote:
>>> My intention is to serve a couple of directories continuously
>>> to a friend. I've tested this using sshfs.
>>
>> Think about security. Just saying.
>
> I have another question about restricting user permissions in this.
> I don't want to show my boobie collection to my wife's sister, do I?

I don't think she'd be interested. She's very likely to have a pair of
her own.

And for some seriousness (really?!?), set the directory permissions to
700 and and ownership to yourself. That way, as long as you're not
sharing the same UID, she won't be able to enter the directory to check
out the boobies.


Regards,
David Bolt

--
Team Acorn: www.distributed.net OGR-NG @ ~100Mnodes RC5-72 @ ~1Mkeys/s
openSUSE 10.3 32b | openSUSE 11.0 32b | | openSUSE 11.2 32b
openSUSE 10.3 64b | openSUSE 11.0 64b | openSUSE 11.1 64b |
RISC OS 4.02 | RISC OS 3.11 | openSUSE 11.1 PPC | TOS 4.02