sshd -p option vs ListenAddress

Peter Stuge stuge-openssh-unix-dev at cdy.org
Wed Dec 14 23:36:33 EST 2005


On Tue, Dec 13, 2005 at 06:49:33PM +0000, Chris Lightfoot wrote:
> If all ListenAddress lines in the sshd_config file specify
> a port, then the -p option to sshd is silently ignored:
> 
> # cat test_sshd_config2 
> ListenAddress 0.0.0.0:22
> ListenAddress 0.0.0.0:2222
> # `pwd`/sshd -D -d -p 4411 -f test_sshd_config2 
[..]
> debug1: Bind to port 2222 on 0.0.0.0.
> debug1: Bind to port 22 on 0.0.0.0.
> Bind to port 22 on 0.0.0.0 failed: Address already in use.
> Cannot bind any address.
> # ^D
> 
> This seems... counterintuitive, at least. Is it the
> intended behaviour?

Two different options (Port and ListenAddress) that control the same
thing are bound to be at least a little bit confusing.

Although sshd_config(5) is somewhat helpful, it doesn't clearly say
that ListenAddress has priority over Port, at least with a
ListenAddress on host 0.

Should Port (or -p when given) options be appended to the
ListenAddress list, with a 0 host?


//Peter




More information about the openssh-unix-dev mailing list