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.