sshd -p option vs ListenAddress

Kevin Steves stevesk at
Sat Dec 17 10:14:07 EST 2005

On Wed, Dec 14, 2005 at 12:48:49PM +0000, Chris Lightfoot wrote:
: On Wed, Dec 14, 2005 at 01:36:33PM +0100, Peter Stuge wrote:
: > > 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.
: No -- it's in the case where all ListenAddress directives
: specify a port, rather than where all specify host = 0.

Summary as I recall:
  -p overrides Port
  ListenAddress :port overrides -p and Port
  -p or Port only used when no ListenAddress :port

The following seem fairly clear to me but I may have written some
of it.


     -p port
             Specifies the port on which the server listens for connections
             (default 22).  Multiple port options are permitted.  Ports speci-
             fied in the configuration file are ignored when a command-line
             port is specified.


             Specifies the local addresses sshd should listen on.  The follow-
             ing forms may be used:

                   ListenAddress host|IPv4_addr|IPv6_addr
                   ListenAddress host|IPv4_addr:port
                   ListenAddress [host|IPv6_addr]:port

             If port is not specified, sshd will listen on the address and all
             prior Port options specified.  The default is to listen on all
             local addresses.  Multiple ListenAddress options are permitted.
             Additionally, any Port options must precede this option for non
             port qualified addresses.

     Port    Specifies the port number that sshd listens on.  The default is
             22.  Multiple options of this type are permitted.  See also

More information about the openssh-unix-dev mailing list