1

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

daizy@192.168.1.11's password: Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.13.0-32-generic x86_64)

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 root@139.59.2.129
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

  • 1
    Try to nc -vz <ip> 22 from your local machine to verify nothing is blocking the port in between (like a firewall). – Mikael Kjær Feb 11 '18 at 5:58
  • 1
    it shows upnc: connect to 139.59.2.129 port 22 (tcp) failed: Connection refused – user3855998 Feb 11 '18 at 5:59
  • There you have it then. Do you have a firewall running anywhere in between? – Mikael Kjær Feb 11 '18 at 6:05
  • 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) – user3855998 Feb 11 '18 at 6:07
  • I have checked firewall also, tested above – user3855998 Feb 11 '18 at 6:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.