Sending signal SIGQUIT to a process forked by remote machine
Hi all,
The setup that I have is as follows:
There are two machines A & B connected to each other both running Redhat 7.3. From A, passwordless ssh to B is enabled, but B to A is not passwordless.
rsh between both the machines is passwordless. On both the machines I have installed my own signal handler for the signal 3 (SIGQUIT) using the environment variable LD_PRELOAD.
From A, a program is invoked on B using ssh or rsh in the following manner:
Machine A> /usr/bin/ssh <IP of B> <absolute path name of the program on B> <Set of arguments>
Machine A> /usr/kerberos/bin/rsh <IP of B> <absolute path name of the program on B> <Set of arguments>
On doing this the remote program (on B) is forked and it starts executing normally.
But I need to send to a signal (SIGQUIT) to the process forked on B so that my signal handler is invoked on B.
For this when I do like this:
Machine B> kill -3 <Pid of the process forked on B>
The process on B is immediately killed and the signal handler is not called. (I have tested that when I invoke the above program from B and then send it the signal SIGQUIT, the installed signal handler is called without any problem.) The processes on A (i.e. rsh and ssh) keep on executing but they are in the state T (maybe Traced).
Is there any way to send a signal to a process which has been invoked from a remote machine?
I searched for this and some results suggested that this cannot be done by ssh but by rsh. Also, in the man page of rsh it was given that :
"Rsh connects to the specified host, and executes the specified command. .... Interrupt, quit and terminate signals are propagated to the remote command; rsh normally terminates when the remote command does."
So I invoked the program using rsh from A to B and found out that on A two processes are created for rsh (In case of ssh only one process is created on A). On sending SIGQUIT to both of them using:
Machine A> kill -3 PId_1
Machine A> kill -3 PId_2
there seems to be no effect on the processes PId_1 and PId_2 and also the remote process on B remains unaffected.
Can anybody suggest what I am doing wrong here when sending the signal to the rsh process and what can I do to call my signal handler on the machine B? And why there are two processes for rsh while only one for ssh?
Hope I have made myself clear.
Thanks in advance
|