Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been running some interactive shell scripts on a remote server.

Sometimes the ssh connection is lost, and I want the process on the other machine to die in such condition.

Can I configure the ssh connection to terminate remote process upon disconnection?

share|improve this question
up vote 1 down vote accepted

You need to set the ClientAliveInterval sshd configuration option to a non-zero value. Once the client fails to respond, the connection will be cut and the remote process will be sent a SIGHUP, stopping it (usually).

share|improve this answer
    
I cannot change the ssh configuration on the other part, just my parameters. – Adam Matan Mar 5 '12 at 8:19
    
Well there's certainly nothing the client can do about it, seeing as how it's already disconnected... – Ignacio Vazquez-Abrams Mar 5 '12 at 8:29
    
Isn't there any request that can be made by the client upon connection, asking for process termination upon disconnection? – Adam Matan Mar 5 '12 at 8:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .