1846794 Members
5769 Online
110256 Solutions
New Discussion

SSH and trap interrupts

 
UxBoD
Frequent Advisor

SSH and trap interrupts

Hi,

I have written a menu shell script for our company and am trapping HUP INT etc which is working fine. We are moving away from telnet, and at the moment I am also trapping these fine via ~/.login and /etc/skel/login for new users. My issue is that when users SSH too the server they can still issue [CTRL-C] at the point they connect, and drop to a command line prompt. What is the best way to trap this ? Replace the shell they execute by my menu script ?

Any help gratefully appreciated.
4 REPLIES 4
Dennis Handly
Acclaimed Contributor

Re: SSH and trap interrupts

Hmm, you can't trap SIGINT?
It seems it should either abort the connection or be sent to the remote shell.
Have you tried using an empty string "" for the command, to ignore the signal?
UxBoD
Frequent Advisor

Re: SSH and trap interrupts

The problem is that when SSH connects it does not appear to process the .login file, and therefore the trap is not executed. I have even set UseLogin yes in /opt/secsh/etc/sshd_config and that does not work :(
UxBoD
Frequent Advisor

Re: SSH and trap interrupts

Fixed :) Some useless person had put a empty trap in a sourced file. Grrrr! Thanks for the help.
UxBoD
Frequent Advisor

Re: SSH and trap interrupts

fixed