I've added the line "Port 110" in /etc/ssh/sshd_config just bellow the existing line "Port 22" and then did an /etc/init.d/sshd restart
expecting to see sshd listening on both ports (22 and 110). However netstat -anp showed that sshd was only listening to the default port (22).
Later I tried bash -x /etc/init.d/sshd restart
and was amazed to see sshd bind to port 110 immediately!!! Issuing a second /etc/init.d/sshd restart
again ignored my change. Rebooting also ignores my change so I'm stuck and utterly puzzled.
UPDATE this strange behaviour appears only on low ports (<1024)
This is on a CentOS 6 server.
Details
Here is my modification to /etc/ssh/sshd_config:
grep ^Port /etc/ssh/sshd_config
Port 22
Port 110
Output of netstat after bash -x /etc/init.d/sshd restart
netstat -anp | grep -i listen|grep sshd|grep -v :::
tcp 0 0 0.0.0.0:110 0.0.0.0:* LISTEN 7031/sshd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 7031/sshd
Output of netstat after /etc/init.d/sshd restart
netstat -anp | grep -i listen|grep sshd|grep -v :::
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 8962/sshd
Another way to convince sshd to bind to port 110 is by running it in debug mode with /usr/sbin/sshd -de
(note the listening on port 22,110
lines but I've also tested by connecting to both ports):
/usr/sbin/sshd -de
debug1: sshd version OpenSSH_5.3p1
debug1: read PEM private key done: type RSA
debug1: private host key: #0 type 1 RSA
debug1: read PEM private key done: type DSA
debug1: private host key: #1 type 2 DSA
debug1: rexec_argv[0]='/usr/sbin/sshd'
debug1: rexec_argv[1]='-de'
Set /proc/self/oom_score_adj from 0 to -1000
debug1: Bind to port 22 on 0.0.0.0.
Server listening on 0.0.0.0 port 22.
debug1: Bind to port 22 on ::.
Server listening on :: port 22.
debug1: Bind to port 110 on 0.0.0.0.
Server listening on 0.0.0.0 port 110.
debug1: Bind to port 110 on ::.
Server listening on :: port 110.
The SELinux system is restricting the port binding for ports below 1024
You can add another port
That would fix you immediate problem.