I use screen all the time and am constantly attaching/detaching from different sessions. Occasionally I'll accidentally logout/exit instead of detach, losing the buffer of my work on that project. I'd rather not have the detach (ctl-a ctl-d) and exit (ctl-d) commands be so close.
Is there a way to force screen to only ever detach instead of exit?
The main problem isn't screen
, it's the shell inside of it. You can make it ignore Ctrl+D or handle it differently. For BASH, try
export IGNOREEOF=4
which means you'll have to press Ctrl+D 4 times to exit the shell.
See this question for more solutions: https://unix.stackexchange.com/questions/27588/how-can-i-keep-controld-from-disconnecting-my-session