[Nolug] Screen howto

From: Mark A. Hershberger <mah_at_everybody.org>
Date: Mon, 31 May 2004 14:23:24 -0400
Message-ID: <873c5gzc9v.fsf@weblog.localhost>

Following is something I posted to my weblog last week that may be of
interest to people here who have terminal login access to *nix boxes.

From: <http://mah.everybody.org/weblog/archive/80614306>

So I was playing with screen and, after Debian put /usr/bin/screen in
my /etc/shells, tried it as a login shell. It works great! I can log
in and, automatically, I'm re-connected right where I left off.

One problem: I use tramp and scp. Tramp and scp just don't work when
screen is the default shell. After struggling mightly with the
documentation, I switched back to bash as my login shell and
implemented the following in my .bash_profile.

Tramp sets $TERM to tramp-terminal-type. By default this is "dumb"
(which is also what $TERM is set to when using scp), and that's good,
because screen can't handle "dumb". It says something like "Clear
screen capability required." At the end of my .bash_profile, I added:

    if [ "$TERM" != "dumb" ]; then
      screen -x -RR
      exit
    fi

So you won't have to look at the man page, "-x" means "attach to an
already attached screen session". You could actually have two
different xterm windows with the same session running in each. If you
prefer that only one window get attached at a time (say, you leave
from work and forget to log out and you want to force that session to
close when you log in from home), then change the "-x" to "-D". "-RR"
just means "Do what ever is necessary to re-attach."

One nice thing about this (versus using /usr/bin/screen as your shell)
is that you have a fallback in case something strange happens with
screen and you can't reconnect with it. In that case:

    TERM=dumb ssh remote-box

and you're back on the system and able to debug your screen problem.

-- 
A choice between one man and a shovel, or a dozen men with teaspoons
is clear to me, and I'm sure it is clear to you also.
    -- Zimran Ahmed <http://www.winterspeak.com/>
___________________
Nolug mailing list
nolug@nolug.org
Received on 06/02/04

This archive was generated by hypermail 2.2.0 : 12/19/08 EST