Today’s neat thing: autossh+rscreen

I use irssi and bitlbee for my IRC and IM connections. I run irssi on a remote server, so I log in via ssh and use screen to keep the process persistent. Whenever I go somewhere (classes, meetings, etc.), I have to log into my server again and resume my screen session. I wanted a way to do this automatically.

Enter autossh. It’s a nice utility that reconnects ssh tunnels. There’s an included script, ‘rscreen’, that reattaches remote screen sessions, which is just what I wanted.

Now whenever I move around, I type ‘~.’ in the terminal window that was previously attached to screen to force the connection to die, and autossh/rscreen will reestablish the ssh connection and reattach to my screen session.

I recommend trying it. Beware, though, the default ‘rscreen’ script will remap your screen escape key (default is ^A) to something else. Take a quick look at the script before you run it.