Warning: remote port forwarding failed for listen port 4043 - SSH

This is a discussion on Warning: remote port forwarding failed for listen port 4043 - SSH ; 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 ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Warning: remote port forwarding failed for listen port 4043

  1. 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

  2. Re: Warning: remote port forwarding failed for listen port 4043

    >>>>> "Ignoramus3694" == Ignoramus3694 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


+ Reply to Thread