Hello Everyone,

After installing my droplet (Ubuntu 18.04) I am trying to change the default ssh port (port 22), I tried several ports and on testing the connection times out, HYG what I tried so far:

1) Changed the port in the file /etc/ssh/sshd_config
2) Restarted the sshd service using systemctl restart sshd
3) Also restarted the ssh service using systemctl restart ssh
4) Tried ssh connecting from outside the droplet using Putty and from another droplet and in both cases the connection times out
5) Tried ssh connecting from localhost and it works on the new port
6) Checked the service status using (systemctl status sshd) & (systemctl status ssh) and both are active and listening on the correct port
7) I also tried adding DO firewall from the console to add a custom port using the new one I added

Don’t know what else to try, can it be related to UFW and how to check/change this?


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.

Submit an Answer
2 answers


If the UFW is enabled you need to put the new port in allow list.

sudo ufw allow <NewPort>
sudo ufw reload

Hello, @aymanroshdy2019

You can use telnet or nmap to see if the port is actually open and if you’re able to receive connections on it:

telnet IPADDRESS port

Let us know how it goes.