ssh client stays connected after remote forward fails to bind

Darren Tucker dtucker at
Tue Sep 11 00:34:53 EST 2007

On Mon, Sep 10, 2007 at 03:12:09PM +0100, Darryl L. Miles wrote:
> My command line looks like this:
> ssh -2 -C -o BatchMode=yes -o KeepAlive=yes -o ServerAliveInterval=600 
> -N -T -x -a -R2401: <host>
> I've tried to instruct SSH that the only purpose it has in life is to 
> provide remote port forwarding (hence the -N -T) but if the remote fails 
> to bind I get an error locally (Could not bind to remove address) and 
> the SSH connection stays open and the client running.  I think the ssh 
> client should terminate at this point as there is no other channel open 
> nor any possibility of a channel being opened (say through dynamic port 
> forwarding).
> Maybe this is user error on my part ?  Would this be considered a bug or 
> a feature ?  I'm using OpenSSH_3.9p1 in the client I've just investigated.

What you're looking for is "ExitOnForwardFailure", which was added in 4.4.

Darren Tucker (dtucker at
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4  37C9 C982 80C7 8FF4 FA69
    Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.

More information about the openssh-unix-dev mailing list