Recently I inherited a RedHat server, which had system-wide user profile configured something like this:

readonly TMOUT
export TMOUT

This was extremely irritating. Spending a few momnents looking at docs and session would time out. The same was true for screen, detached sessions would close. All in all virtually nothing could be done.

Then I came across this post, which I am basically replicating here, in case the original disappears.

After logging in I would do the following:

somedude@ultra:~$ exec env -u TMOUT ksh

This will fire up ksh with TMOUT variable unset. After that I could use screen just fine, detaching and reattaching without timeout or screen session getting terminated.