Ubuntu – SSH refusing connection after changing default port

serverssh

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?

Best Answer

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.

Related Question