Question

Changing SSH port on ubuntu 14.04 server fails

Posted June 20, 2014 12.8k views
i followed this tutorial step by step, https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-12-04 and I changed the ssh port to something else but when I ssh it it, it wont work anymore, I also tried to add it to firewall using the following commands: $: iptables -A INPUT -p tcp -m tcp --dport 25000 -j ACCEPT $: iptables-save but still I can not SSH to my droplet, it wont even ask my username, it just times out
2 comments

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

4 answers
Did you restart ssh after changing the port? sudo service ssh restart
Do you currently still have ssh root access?
jt, yes I did restart ssh info, I did not have SSH access at all, neither root nor non-root, I deleted the whole droplet, I created it many times, and re did everything...nothing works, I tried on both 12.04 and 14.04 ubuntu

First check that your sshd is up and serving on port 25000 with the following command
ss -nlput | grep sshd
or
netstat -np tcp | find "25000"

If it is, and you’re still unable to connect with it, there’s a chance, that your ISP is blocking that port. Change the port to something more unique than equal thousand, like 38621.

Try also adding your ip/subnet to /etc/hosts.allow and cat /etc/hosts.deny if it has your ip in it.

Submit an Answer