I am not able to connet to any remote server. It shows up this error. I am able to ping the same ip address.
Also I checked sshd is running :
sudo service sshd status
ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2018-02-11 10:35:22 IST; 47min ago
Main PID: 2610 (sshd)
CGroup: /system.slice/ssh.service
└─2610 /usr/sbin/sshd -D
Also the port is active & listening :
netstat -lnp | grep 22
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp6 0 0 :::22 :::* LISTEN -
unix 2 [ ACC ] STREAM LISTENING 22969 1268/dbus-daemon @/tmp/dbus-gnLG2rgPez
I checked firewall also :
sudo ufw status
Status: active
To Action From -- ------ ----
22 ALLOW Anywhere
3000 ALLOW Anywhere
OpenSSH ALLOW Anywhere
22 (v6) ALLOW Anywhere (v6)
3000 (v6) ALLOW Anywhere (v6)
OpenSSH (v6) ALLOW Anywhere (v6)
Then I tried disabling firewell also. It did not work.
I am able to SSH localhost as below :
ssh 192.168.1.11
[email protected]'s password: Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.13.0-32-generic x86_64)
- Documentation: https://help.ubuntu.com
- Management: https://landscape.canonical.com
- Support: https://ubuntu.com/advantage
21 packages can be updated. 0 updates are security updates.
Last login: Sun Feb 11 11:00:36 2018 from 192.168.1.11
I am using Ubuntu 16.04 & I am trying to connect to a Digital Ocean Server. It worked properly before 8th Feb. I did not change any SSH configuration.
If I try on another port :
ssh -p 80 [email protected]
ssh_exchange_identification: Connection closed by remote host
ssh -vvv 139.59.2.129
OpenSSH_7.2p2 Ubuntu-4ubuntu2.4, OpenSSL 1.0.2g 1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "139.59.2.129" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to 139.59.2.129 [139.59.2.129] port 22.
debug1: connect to address 139.59.2.129 port 22: Connection refused
ssh: connect to host 139.59.2.129 port 22: Connection refused
I could also easily login to localhost using:
ssh -vvv localhost
nc -vz <ip> 22
from your local machine to verify nothing is blocking the port in between (like a firewall).