I am running CentOS release 6.2 (Final).
I want the sshd port of listen on ports 22 and 1022.
I have add the following lines to /etc/ssh/sshd_config:
Port 22
Port 1022
and restarted sshd and turned iptables off however I cannot connect to sshd on port 1022.
Even if I do the following
#Port 22
Port 1022
sshd continues listening on port 22 and does not listen on port 1022. I have tried other port values besides 1022 but no luck.
Help!
Best Answer
If you were using CentOS 5 the configuration you describe does work but a quick test suggests that sshd on CentOS 6 won't bind to any port below 1023 except 22 - I can't find a reference for this at the moment. If you want to access sshd on multiple ports then pick one >=1024.
Update - this is related to SELinux. Current policy doesn't allow sshd to bind to non standard ports below 1023 (as experiment confirms) e.g.
If you want to add an additional port <=1023 you will have to explicitly allow it in SELinux
then restart sshd