Archive for February 19th, 2008

Using GNU Screen with SSH (and other tutorials)

There are also a number of tutorials on how to keep environment variables set in screen sessions. Why does this matter? Because SSH relies on it - for SSH agent operation, as well as X forwarding. Thus, each of the articles solve a slightly different problem, but it all comes out to the same thing: getting the environment variables right.

Many of the tutorials start with this problem: one starts ssh-agent, then screen: now how do the sessions maintain the proper environment variables? This article by Charles Fry shows a way to craft a screen initialization script with the proper variables. This article suggests using a screen “wrapper”: run screen first, then ssh-agent, the screen again. The inner screen session then becomes the main session, and the outter session mainly holds the results of the ssh-agent run.

Some tutorials handle a different problem: one starts ssh-agent, then connects to another machine with ssh - then runs screen after that. That screen session will become “disconnected” from the ssh-agent forwarding scheme once you exit and connect to it from another machine. The environment variables are no longer valid. The basic solution is to overwrite the session environment variables with the current (and correct) version. Samat Jain has an article on this, and Sam Rowe also has an interesting article at deadman.org about the same thing.

On a different note, there is an excellent tutorial and overview of GNU screen at polishlinux.org. While it is from July of 2007, it remains up to date - I just don’t know why I haven’t seen it until now. If you haven’t started using screen, this is a good place to begin.

Of course, there is my book GNU Screen: A Comprehensive Introduction.


1 comment 19 February 2008


David Douthitt

David is an experienced UNIX and Linux system administrator, a former Linux distribution maintainer, and author of two books ("Advanced Topics in System Administration" and "GNU Screen: A Comprehensive Manual"). View David Douthitt's profile on LinkedIn

Recent Posts

Top Posts

RSS Sharky's Column!

Calendar

February 2008
M T W T F S S
« Jan   Mar »
 123
45678910
11121314151617
18192021222324
2526272829  

Recent Comments

bharat on The Demise of the HP-UX System…
H4mm3r on Avoiding catastrophe!
Vladimir on Argument list too long?
ddouthitt on The UNIX find command and…
Mihir G joshi on The UNIX find command and…

Category Cloud

BSD Career Debian Debugging Fedora FreeBSD HPUX Learning Linux MacOS X Mind Hacks Mobile Computing NetBSD Networking OpenBSD OpenSolaris Open Source OpenVMS Personal Notes Portable Presentations Red Hat Scripting Security Solaris Tips Ubuntu UNIX Wheel Group Windows

Archives

Feeds

Links