Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have changed my /etc/ssh/sshd_config adding multiple ports for it to listen:

$ grep Port /etc/ssh/sshd_config 
Port 22
Port 80
Port 443

However, after a service sshd restart (which shown no errors) I still cannot connect into any of the non standard ports, neither the server seems to be listening:

$ netstat -an |grep LISTEN| grep -e "22\|80\|443" 
tcp        0      0        *                   LISTEN      
tcp        0      0 :::22                       :::*                        LISTEN      

No firewall rules to bother either:

$ iptables -L -n -v
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
46012   61M ACCEPT     all  --  *      *             state RELATED,ESTABLISHED 
    0     0 ACCEPT     icmp --  *      *             
    9   338 ACCEPT     all  --  lo     *             
  187 11232 ACCEPT     tcp  --  *      *             state NEW tcp dpt:22 
   79  4171 REJECT     all  --  *      *             reject-with icmp-host-prohibited 

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 REJECT     all  --  *      *             reject-with icmp-host-prohibited 

Chain OUTPUT (policy ACCEPT 25028 packets, 2107K bytes)
 pkts bytes target     prot opt in     out     source               destination         

And just to be sure I even made a few tests after a service iptables stop, to no effect.

Found some people here with similar issues, but not quite the problem: Basic SSH port change not working on EC2 instance

My SO:

$ uname -a
Linux ip-xxx 2.6.32-358.el6.x86_64 #1 SMP Tue Jan 29 11:47:41 EST 2013 x86_64 x86_64 x86_64 GNU/Linux

Any idea?

share|improve this question
Did you allow port 22 or the other ports listed through your security group? – Nathan C Aug 24 '13 at 2:19
yes I did. my security group has all tcp ports open. – filippo Aug 24 '13 at 2:54
could you try port 2222 ... i'm thinking maybe there's an issue with the more common 80 & 443 – Drew Khoury Aug 24 '13 at 6:21
Ensure that your Port declarations are before any ListenAddress declarations, secondly restart sshd, grep sshd /var/log/auth.log and post the results, that should shed some light. – Aaron Tate Aug 24 '13 at 7:59
@DrewKhoury Indeed you are right. It is a test I've made before and should have commented here: all high ports I've tried (like 2222) will work fine. However I did not any documentation about restrictions on binding to lower ports apart from that only root can create reroutes (iptables) to them. In any case, I am obviously making these configurations as root :( – filippo Aug 24 '13 at 15:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.