prototype of simple NX client with auto-resuming ssh session

Misha Koshelev misha680 at gmail.com
Thu Apr 22 08:08:48 EST 2010


Keisial wrote:
> Misha Koshelev wrote:
>> p.s. Also right now I have functionality to spawn the server directly from the client, but somehow the signal(SIGHUP,SIG_HUP) command causes _both_ the server and client to ignore SIGHUP, even though it is called _only_ in the client. Any ideas? Thank you!
>>   
> (I assume you mean SIG_IGN, not SIG_HUP)
> 
> The server inherits the ignoring of SIGHUP. From signal(7)
>>         A  child  created  via  fork(2)  inherits  a  copy  of  its
>> parent's signal dispositions.  During an
>>        execve(2), the dispositions of handled signals are reset to the
>> default; the dispositions of ignored
>>        signals are left unchanged.
> 
> Perform signal(SIGHUP, SIG_DFL); after the fork but before the execv (or
> simply set SIGHUP to whatever you want in the server).
> 

I am sorry. Not sure what I was on when writing my email this morning ;)

What I meant is the following. I have machine A from which I am connecting, machine B _to_ which I am connecting.

Two scenarios:
i) I start server on machine B. Then, from machine A, I do ssh B nx/client. Now, on machine B, I do killall client. SIGHUP is sent, client dies, ssh session from machine A ends.
ii) I ssh B nx/client; the _client_ spawns the server. Now, on machine B, when I do killall client, the client dies but SSH DOES NOT DISCONNECT!

Why would this be?

Thank you
Misha Koshelev

p.s. The other problem is as follows: in the "nxssh" executable, I have a while (1) loop where I _fork_ to start a child process, and then execl ssh. The parent simply has a wait(NULL) call.

Now, from the command line, this creates the illusion of a seamless SSH session after disconnects. However, nxclient somehow detects this. Any ideas?


More information about the openssh-unix-dev mailing list