Using screen as default shell
GNU Screen is excellent sysadmin tool and can make your life much easier.
If working on remote ssh shell and connection is interrupted (usually at worst time) I often wish that I’ve started screen in advance.
Other useful way of using it is to execute long remote jobs – no more redirections needed.
One of most “obvious” solution is to change default shell for the user in /etc/passwd.
Unfortunately it causes some incontinences – SCP does not work correctly, aliases do not work correctly etc. not to mention that it does not apply when becoming another user by using “su -”
Here is how I solve above problems…
Instead of modifying /etc/passwd I do add following lines in ~/.bash_profile.
if [[ ( -z "$STY" ) && ( ! -z "$SSH_CONNECTION") ]]
screen -S shell -x 2> /dev/null || screen -S shell
Advantage of doing the change is that it is executed when user is entering in the system via ssh and when nondetached session is found.