While connecting to the server using command ssh user@hostname / ssh user@ipaddress in command prompt (Terminal) you may get some issue like ssh: connect to host @hostname port 22: Connection timed out.
Such issue may occur, either your server is down or there is problem with the firewall connection.
Fix Issue, ssh: connect to host @hostname port 22: Connection timed out
Check server is down or not
Use ping ipaddress
to check server is down or not. If it is working then, there may be some problem with the firewall configuration.
Configure UFW to allow incoming SSH connections
To allow ssh connection, use the following command in the terminal.
sudo ufw allow ssh
Allowing SSH by Port Number 22
sudo ufw allow 22
Enable firewall
After allowing incoming SSH connections, you can enable the firewall with the following command in command line (Terminal)
sudo ufw enable