f



Warning: remote port forwarding failed for listen port 4043

I have a script that does a port forwarding for me: 

ssh -n  -R localhost:4043:localhost:22 remoteserver.example.com 

The problem with this is that if port forwarding fails, ssh prints

Warning: remote port forwarding failed for listen port 4043

But it STAYS CONNECTED instead of properly failing with exit code. 

So it is a MAJOR pain to detect this condition and kill ssh. 

How can I change is so that, when report port forwarding cannot be
accomplished, ssh exits right away? 

I think that it is a bug, period.

thanks

i
0
Ignoramus3694
10/9/2007 2:06:38 PM
comp.security.ssh 4228 articles. 0 followers. terra1024 (490) is leader. Post Follow

1 Replies
5968 Views

Similar Articles

[PageSpeed] 39

>>>>> "Ignoramus3694" == Ignoramus3694  <ignoramus3694@NOSPAM.3694.invalid> writes:

    Ignoramus3694> I have a script that does a port forwarding for me: ssh
    Ignoramus3694> -n -R localhost:4043:localhost:22
    Ignoramus3694> remoteserver.example.com

    Ignoramus3694> The problem with this is that if port forwarding fails,
    Ignoramus3694> ssh prints

    Ignoramus3694> Warning: remote port forwarding failed for listen port
    Ignoramus3694> 4043

    Ignoramus3694> But it STAYS CONNECTED instead of properly failing with
    Ignoramus3694> exit code.

    Ignoramus3694> So it is a MAJOR pain to detect this condition and kill
    Ignoramus3694> ssh.

    Ignoramus3694> How can I change is so that, when report port
    Ignoramus3694> forwarding cannot be accomplished, ssh exits right
    Ignoramus3694> away?

Reading the documentation [ssh_config(5)]:

     ExitOnForwardFailure
             Specifies whether ssh(1) should terminate the connection if it
             cannot set up all requested dynamic, tunnel, local, and remote
             port forwardings.  The argument must be ``yes'' or ``no''.  The
             default is ``no''.

    Ignoramus3694> I think that it is a bug, period.

It is not a bug, since that is how it is documented to work.

    Ignoramus3694> thanks

    Ignoramus3694> i

-- 
  Richard Silverman
  res@qoxp.net

0
res49 (1410)
10/10/2007 1:03:03 AM
Reply: