currently I'm handling 2 server (A and B). In server A I installed Ubuntu 12.10. I changed the SSH port into 1198 and it works fine. In server B it has been installed with Ubuntu 11.04. I tried to change the port number into 1198 as well but it refused the connection when I tried to connect again using Putty.

I change the SSH configuration on /etc/ssh/sshd_config and I did restart the SSH using sudo service ssh restart. I was thinking its because of firewall allowed port but the firewall shows inactive when I run sudo ufw status.

Any idea why this can happened?

  • Can you run a portscan against machine B? sudo nmap -sV <host> – OrangeTux Jan 28 '14 at 7:51
  • Also, 11.04 no longer receives updates and 12.10 will be EOL come April, so you really should switch to a current Ubuntu version. For servers, I generally recommend 12.04, which is a LTS version and will be updated until April 2017. – drc Jan 28 '14 at 9:56
  • Could you add results of sudo netstat -lntp | grep ssh? – user.dz Jan 28 '14 at 11:28

I wanted to share my experience for anyone else that may run into this.

After changing the port and restarting the SSH service as you also tried, I was still not able to connect on the new port I specified. When I ran sudo netstat -lntp | grep ssh it showed that my SSH service was still listening on port 22, despite supposedly successfully restarting the service.

Only after rebooting the machine and re-running netstat I saw my service was finally listening on the specified port.


For the changes to be applied, you need to restart the service sshd and not necessarily the pc (but you might as well).

you can do that by running

sudo service ssh restart

In my case I forgot to set virtual server rule on my router. Don't forget to associate port with host under NAT.

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.