Re: pb with remote command cleanup



Thank you for your help but my problem is not a connection problem. I'm worrying about the remaining command that is still running on the remote side after connection lost.

Keepalives enable me to kill connection sooner or later but doesn't guarantee any remote command destruction and that is the real problem : if a user launch, using ssh, a remote process that is CPU intensive and then kill his terminal (or hit ctrl-C), the CPU intensive task is still running on the remote side despite the lost of the connection.

I'm looking for a way to handle remote command destruction after connection lost ? Maybe an sshd_config parameter ? Maybe a patch ?

Thanks

Darren Dunham a écrit :
Mat <matthieu.hautreux@xxxxxxxxxxx> wrote:
I have a cleanup problem when I remote execute a command using ssh. If I kill ssh client during remote execution (with ctrl-C or by closing the terminal) then remote command still exists.

Here is what's happening :

[mat@myfirsthost ~]$ ssh mysecondhost sleep 3600
Killed by signal 2.
[mat@myfirsthost ~]$ ssh mysecondhost ps -fu mat | grep sleep
mat 3570 1 0 22:04 ? 00:00:00 sleep 3600
mat 3685 3492 0 22:09 pts/1 00:00:00 grep sleep


Is there a way for sshd to kill all childs when connection is closed/lost ? Maybe there is an option in sshd_config that can do it but I didn't find any.

You can set keepalives (like ClientAliveInterval/ClientAliveCountMax).
If the client isn't heard from, then it will poll and eventually kill
the connection if the client doesn't respond.

Don't set them too low or it will kill the connection even during
temporary network outages.

Most idle sshd processes don't take up much resources (certainly not
much CPU), so I'd normally set the time limit several hours or greater.
Your environment may demand otherwise.

.



Relevant Pages

  • Re: pb with remote command cleanup
    ... Keepalives enable me to kill connection sooner or later but doesn't guarantee any remote command destruction and that is the real problem: if a user launch, using ssh, a remote process that is CPU intensive and then kill his terminal, the CPU intensive task is still running on the remote side despite the lost of the connection. ... do you know the way to ask for this kind of improvement in openSSH? ...
    (comp.security.ssh)
  • Re: pb with remote command cleanup
    ... worrying about the remaining command that is still running on the remote ... side after connection lost. ... Keepalives enable me to kill connection sooner or later but doesn't ...
    (comp.security.ssh)
  • Re: pb with remote command cleanup
    ... worrying about the remaining command that is still running on the remote ... side after connection lost. ... running on the remote side despite the lost of the connection. ...
    (comp.security.ssh)
  • Re: pb with remote command cleanup
    ... worrying about the remaining command that is still running on the remote side after connection lost. ... Keepalives enable me to kill connection sooner or later but doesn't guarantee any remote command destruction and that is the real problem: if a user launch, using ssh, a remote process that is CPU intensive and then kill his terminal, the CPU intensive task is still running on the remote side despite the lost of the connection. ...
    (comp.security.ssh)
  • Re: Killing a thread started with delegate.BeginInvoke()
    ... connection string to force connection pooling to be on (i think it is off ... for remote configurations) if object creating is particularly expensive. ... you wouldn't need to kill threads. ... > I have a server exposing a remote object. ...
    (microsoft.public.dotnet.framework)