3

I've been trying to change my ssh port without success and none of the suggestions I've found did the trick for me.

I'm on Trusty 14.04 at Rackspace (upgraded from Precise). This is the sequence of steps I've taken to change the ssh port

I just can't seem to change the Port ssh is listening on. Changed sshd_config

AllowUsers abc
Port 9603

Reloaded sshd

sudo /etc/init.d/ssh restart

Opened the firewall

sudo ufw enable
sudo ufw allow 9603
sudo ufw reload

But I always get connection refused when I try to connect.

ssh abc@1.2.3.4 -p 9603

When I run netstat -an | grep "LISTEN ", I get

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
tcp6       0      0 :::80                   :::*                    LISTEN     
tcp6       0      0 :::22                   :::*                    LISTEN  

For some reason, it looks like ssh is not changing ports despite my changes. Any suggestions? I have no moves left

  • 5
    Just to verify, you are editing the file at /etc/ssh/sshd_config, right? Also, is there any difference if you try sudo service ssh restart? – saiarcot895 May 24 '14 at 0:28
  • Post your entire sshd_config on a pastebin for review. – Panther May 24 '14 at 0:52
  • 3
    You're right! sudo service ssh restart did the trick! Thanks. If you "answer" the question, I'll give you the appropriate kudos – Marc May 24 '14 at 0:59

Your Answer

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

Browse other questions tagged or ask your own question.