Live data from Hacker News

Ask HN: moving beyond screen to persist SSH sessions?

news.ycombinator.com

21–30 of 36 posts

Re: Ask HN: moving beyond screen to persist SSH sessions?

#21
post #16

When you start a local shell, you can generate some session identifier (export DURABLE_SESSION=$RANDOM) and put it in your environment. Then have your ssh client send it to the server with "-o SendEnv DURABLE_SESSION". One question is when does sshd know when to ditch interrupted sessions.

You can always manually interrupt an SSH (or Telnet) session using the following key sequence: This sequence is caught by the SSH client to force a session disconnect.

You are of course correct, but that's not related to what I'm getting at.

My question raised the point that the server would not be able to tell the difference, after an interruption, between session state that the client will hope to resume and session state that should be discarded. That state would accumulate until some routine cleared it out.

Re: Ask HN: moving beyond screen to persist SSH sessions?

#22
post #15

Not quite what you are asking for but it would solve the problem: 1. Get an Android. 2. Hack it and install the debian subsystem. 3. see: http://brad.livejournal.com/2400054.html So now instead of running an ssh to a remote server you are running an ssh to your android which then hosts all of the outward ssh sessions. Because of the androids 2g/3g you can't lose your connection (well not easily).

I truly feel sorry for you if your cell phone has a more stable internet connection than a desktop.

Re: Ask HN: moving beyond screen to persist SSH sessions?

#23
post #22
post #15

Not quite what you are asking for but it would solve the problem: 1. Get an Android. 2. Hack it and install the debian subsystem. 3. see: http://brad.livejournal.com/2400054.html So now instead of running an ssh to a remote server you are running an ssh to your android which then hosts all of the outward ssh sessions. Because of the androids 2g/3g you can't lose your connection (well not easily).

I truly feel sorry for you if your cell phone has a more stable internet connection than a desktop.

Cellphones: always connected to cell towers. Conneciton isn't great but its almost always there.

Laptop: network changes as you move from one wifi hotspot to another.

I'm advocating moving his ssh connections to route through the android rather than directly from the laptop to the server.

Re: Ask HN: moving beyond screen to persist SSH sessions?

#24
post #19

To solve your problem just use ssh -o TCPKeepAlive=no restOfYourCommandGoesHere From the ssh_config manpage: "TCPKeepAlive Specifies whether the system should send TCP keepalive messages to the other side. If they are sent, death of the connection or crash of one of the machines will be properly noticed. However, this means that connections will die if the route is down temporarily, and some people find it annoying.…

While that may improve the situation, it won't help if your IP address changes during the outage.

Re: Ask HN: moving beyond screen to persist SSH sessions?

#25
On Windows, I use Bitvise Tunnelier and the SSH tunnels/connections always keep retrying if there's a disconnect. For the terminals, I just use screen so I can get right back to what I was doing, but it is annoying to lose all those consoles if I had a bunch open.

Re: Ask HN: moving beyond screen to persist SSH sessions?

#26
That depends. Can you mess around with the server? If so you could install HIP [1][2][3] on both client and server as a way of providing IP mobility. Basically the way it works is it inserts a layer between the routing and transport layers (called the shim layer), which handles mobility. The transport layer gets a locally significant identifier that uniquely identifies the connection on that host. This remains persistent even after the IP address changes. The shim layer then notices when you've got a new IP address and alerts the other host or notices when the other host has stopped responding for a while and waits for it to make contact again. You'll probably also need access to a DNS server that you can update on the fly, since HIP resolves HITs (HIP identifiers) to IP addresses via DNS. This isn't by any means a production solution, but if you're willing to try it out I'd love to hear how it works out for you :) Also the third reference explains how it works far better than I did.

[1] http://www.openhip.org/

[2] http://en.wikipedia.org/wiki/Host_Identity_Protocol

[3] http://infrahip.hiit.fi/

Re: Ask HN: moving beyond screen to persist SSH sessions?

#30
post #29

As a very meta aside, this is the sort of Ask HN posting that really deserves to be on the front page. If you're reading this whole thread and you think it's interesting; please be sure to upvote the story so we can all set a good example.

Thanks; I was actually concerned that my question might be inappropriate because it's a sort of "help me!"/tech support type question. I tried unsuccessfully to find a FAQ which explains what types of questions are appropriate, but couldn't find anything so I just posted anyway. I figured if it wasn't ok, it wouldn't get voted on; so no harm done.
Post reply on HN