I'd like to configure SSH and screen such that a login will always reattach to a screen session. Ideally, that session would not quit but detach when I press C-d. How can this be achieved? And what other useful settings are there to make my SSH-life easier?
How to effectively use screen and SSH?
ssh;gnu screen
I just did the following for all of my servers so that when I connect via SSH I am automatically put into a Screen session.Add the following to the ~/.bashrc for your user accounts:# Auto-screen invocation. see: http://taint.org/wk/RemoteLoginAutoScreen# if we're coming from a remote SSH connection, in an interactive session# then automatically put us into a screen(1) session.   Only try once# -- if $STARTED_SCREEN is set, don't try it again, to avoid looping# if screen fails for some reason.if [ $PS1 !=  -a ${STARTED_SCREEN:-x} = x -a ${SSH_TTY:-x} != x ] then  STARTED_SCREEN=1 ; export STARTED_SCREEN  screen -RR -S main || echo Screen failed! continuing with normal bash startupfi# [end of auto-screen snippet]This will start a screen session named main if it doesn't exist or reconnect to it if it does. This was done because I have several other screen sessions running detached for various services and didn't want to connect to them.