Package: openssh-client Version: 1:4.6p1-5 Severity: normal Since -f makes the ssh client daemonise, it would be useful if there were a way for it to behave like a proper daemon and drop a pid file or otherwise have the daemon's pid be communicated to the caller (outputting it to stdout would also work). Furthermore, it would be useful if a daemonised ssh client listened for some signal and acted the same as if ctrl-d had been pressed -- wait for all client connections to finish, and then exit. My particular motivation for needing this is that I'd like to use ssh connection sharing. But I know that just starting the master ssh process by hand won't work (I'll forget). And my laptop moves between networks, which would cause the master to need to be restarted. And sometimes networks glitch, which again could freeze a ssh connection and need it to be restarted. So I'd like to start using ssh connection sharing at the beginning of some long operation that involves lots of sshing, and stop it at the end of that operation. If I run ssh -MRf, it forks to the background and I have no good way to determine its pid to kill it later. And if I do kill it later, any signal I use seems to make it immediately die, closing any connections that might be open. While I know when my long operation is over, it's certianly possible that I've made other unrelated connections to the same host during it; to have these die at the end would be unexpected. Without changes to ssh, the best it seems I can do is write a program that: * Runs ssh -M host "echo started; read" in the foreground. * Waits for the "started" to appear, so I know that the master connection is set up. * Backgrounds the control program, and the ssh process. * Waits for a signal, and sends "\n" through ssh. * ssh will then wait for any client connections to close before exiting. This seems doable, but pretty complex when ssh could make it trivial to do the same thing if it behaved more like a proper daemon: * pid=$(ssh --print-pid -NMf host) * kill $pid -- System Information: Debian Release: lenny/sid APT prefers unstable APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental') Architecture: i386 (i686) Kernel: Linux 2.6.22-2-686 (SMP w/1 CPU core) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages openssh-client depends on: ii adduser 3.105 add and remove users and groups ii cdebconf [debconf-2.0 0.125 Debian Configuration Management Sy ii debconf [debconf-2.0] 1.5.14 Debian configuration management sy ii dpkg 1.14.7 package maintenance system for Deb ii libc6 2.6.1-5 GNU C Library: Shared libraries ii libcomerr2 1.40.2-1 common error description library ii libedit2 2.9.cvs.20050518-4 BSD editline and history libraries ii libkrb53 1.6.dfsg.3~beta1-1 MIT Kerberos runtime libraries ii libncurses5 5.6+20071006-3 Shared libraries for terminal hand ii libssl0.9.8 0.9.8f-1 SSL shared libraries ii passwd 1:4.0.18.1-11 change and administer password and ii zlib1g 1:1.2.3.3.dfsg-6 compression library - runtime openssh-client recommends no packages. -- no debconf information -- see shy jo
Attachment:
signature.asc
Description: Digital signature