5

Well, I need use multiple and distinct ports where sshd will be listening, for distincts clients. Each client connect a different ssh port in real time.

Can I put sshd service listening on multiple ports? Something like a port range in sshd config file ?

Thanks in advance.

5

See man-page of sshd-config:

ListenAddress Specifies the local addresses sshd(8) should listen on. The fol- lowing 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.

Edit

Port

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

7
  • 1
    But, you should note that by default maximum number of listening ports for sshd is 256. May 20 '13 at 9:33
  • so, but can I use Port 22 Port 25980 Port 25981 Port 25982 , etc. I need not qualified address only. There is no limits in ports number?
    – ManuParra
    May 20 '13 at 9:39
  • 1
    See my edit, you can define multiple Port entries.
    – j.holetzeck
    May 20 '13 at 9:43
  • 2
    You can have more than 256 by starting a separate instance of sshd, with it's own config file and ports-list.
    – Don Simon
    May 20 '13 at 14:00
  • 2
    It took me some time to realize, if you specify multiple ports in Port section, make sure to have the smallest port number listed first, otherwise it won't work, at least on Amazon Linux, OpenSSH_6.6.1p1 Oct 12 '16 at 20:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.