ssh: connect to host 192.168.0.102 port 22: Connection refused code example
Example 1: ssh: connect to host 165.22.132.219 port 22: Connection refused
# First Check whats your ssh Port # in Server.
$ grep -i port /etc/ssh/sshd_config
#Port 22
#GatewayPorts no
ssh root@ipaddress -p port-Number
ssh [email protected] -p 2020
Example 2: ssh: connect to host 192.168.178.45 port 22: Connection refused lost connection
Your ISP may block connections to port 22 (nothing you or your router can do about it). Just set SSHd to run on a different port, e.g. 2222.
In /etc/ssh/sshd_config, change Port 22 to Port 2222 and then sudo service ssh restart. Port forward 2222 (or whatever), and try again.