Linuxボックスがあり、sshでログインすると、キーストロークと手動トランスポートの両方がセッションをCtrl-C
直接SIGINT
終了します。
λ> ssh root@rhel74
Last login: Sun Mar 18 21:08:02 2018 from 10.84.40.182
rhel74:~ # ^CConnection to rhel74 closed.
λ> ssh root@rhel74
Last login: Sun Mar 18 21:11:38 2018 from 10.84.40.182
rhel74:~ # ps -ef | grep bash
root 132203 132199 0 21:11 pts/0 00:00:00 -bash
root 132246 132203 0 21:11 pts/0 00:00:00 grep --color=auto bash
rhel74:~ # kill -2 132203
Connection to rhel74 closed.
trap
ディスプレイはSIGINT
で処理されますexit
。別のシェルを作成すると、期待SIGINT
どおりに機能します。
rhel74:~ # trap
trap -- 'exit' SIGINT
trap -- 'exit' SIGTERM
trap -- '' SIGTSTP
trap -- '' SIGTTIN
trap -- '' SIGTTOU
rhel74:~ # bash
rhel74:~ # trap
trap -- '' SIGTSTP
trap -- '' SIGTTIN
trap -- '' SIGTTOU
rhel74:~ # ^C
しかし、シェルのデフォルトのトラップハンドラを正確に決定するのは何ですか?Ctrl-C
SSHセッション終了動作を変更する方法は?