How can I keep control+d from disconnecting my session?

You're looking for the IGNOREEOF environment variable if you use bash:

IGNOREEOF

Controls the action of an interactive shell on receipt of an EOF character as the sole input. If set, the value is the number of consecutive EOF characters which must be typed as the first characters on an input line before bash exits. If the variable exists but does not have a numeric value, or has no value, the default value is 10. If it does not exist, EOF signifies the end of input to the shell.

So export IGNOREEOF=42 and you'll have to press Ctrl+D fourty-two times before it actually quits your shell.

POSIX set has an -o ignoreeof setting too. So consult your shell's documentation to see if your shell has this (it should), and to check its exact semantics.


tcsh set ignoreeof or set ignoreeof=<any value not 1> works