ProxyCommand and ExitOnForwardFailure = leftover process
Lars Andersson
larsand at gmail.com
Wed Aug 13 23:09:05 EST 2008
Hi,
I'm having a small problem when using ProxyCommand and
ExitOnForwardFailure in combination with OpenSSH 5.1 under Ubuntu
8.04.
In order to enable multihop scp and port forwarding, I have enabled
automatic public key authenticated tunneling from hostA to hostC via
hostB using ProxyCommand in my private .ssh/config file on hostA.
<end of .ssh/config>:
host hostB
user X
hostC
ProxyCommand ssh hostB nc hostC 22
Now, on hostA, I want to forward local port 3333 to port 5433 on hostC
from a script using:
ssh -x -N -L 3333:hostC:5433 -o BatchMode=yes -o
ExitOnForwardFailure=yes X at hostC
That works fine, and I now have two processes:
<pid> <cmdline>
31292 ssh -x -N -L 3333:hostC:5433 -o BatchMode=yes -o
ExitOnForwardFailure=yes X at hostC
31293 ssh hostB nc hostC 22
I assume the second is started by the first to forward the tunnel via
hostB. I can use the local port 3333 to connect to the server running
on port 5433 on hostC. So far so good.
If I kill process 31292 it will also terminate 31293 and the TCP
connections will eventually shut down fine.
if I instead leave the first ssh tunnel running and issue the tunnel command,
ssh -x -N -L 3333:hostC:5433 -o BatchMode=yes -o
ExitOnForwardFailure=yes X at hostC
a second time, I get the following messages (ssh pid=31923):
bind: Address already in use
channel_setup_fwd_listener: cannot listen to port: 3333
Could not request local forwarding.
ssh (pid 31923) exits as can be expected since I specified the
ExitOnForwardFailure=yes option. However, this time, ssh doesn't kill
the ssh sub process doing the forwarding via hostB, and I'm left with
a leftover ssh process:
31924 ssh hostB nc hostC 22
I guess this is not a huge issue, and I'm sure I can come up with some
workaround, but it currently creates a few problems in my scripts. Is
this a bug, or is this behavior normal?
Thanks,
Lars
More information about the openssh-unix-dev
mailing list