11

I am trying to SSH connect from my MacBook to my Ubuntu machine. I have typed in this command ssh -p 22 -vvv <username>@<ip> The firewall is also disabled in the server side, and typed systemctl status sshd to make sure if it is open.

It connects, but does not show the prompt at all.

OpenSSH_7.6p1, LibreSSL 2.6.2
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line  48: Applying options for *
debug1: /etc/ssh/ssh_config line 52: Applying options for *
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to <ip> port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /Users/sss/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/sss/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/sss/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/sss/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/sss/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/sss/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/sss/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/sss/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6

It always seems to get stuck in the last line.

I am testing my MacBook on a different network, but when I try the same command in the same Wifi, it works perfectly.

(I've already tried various stuff in the internet and still does not work) I just started using Ubuntu, so the problem might actually be simple.

  • Are you saying the client machine can connect to the server from one network, but the same client machine trying to connect to the same server from another network gets stuck at that point? – rfc2460 Feb 2 '19 at 10:06
  • Unless the use of DNS by sshd is disabled in /etc/ssh/sshd_config on the Ubuntu server, it might be trying to find out the name of the system you're connecting from - and if you're in another private network behind a NAT, that is unlikely to succeed. Try adding/uncommenting UseDNS no in sshd_config and then restarting sshd with systemctl restart sshd. – telcoM Feb 2 '19 at 10:19
  • @telcoM It is already uncommented in the file. – Mallow Marsh Feb 6 '19 at 10:22
  • 1
    My problem was a dropped but not closed remote ssh port connection. – Ray Foss Jun 24 '19 at 19:54
  • 1
    FWIW, I'm seeing this exact thing. The server (a RasperryPi) creates a reverse tunnel to a server I have on the internet. After some possible (but not proven) corruption issues, I can connect to the RPi without problems from the local network but when I connect via the reverse tunnel it gets stuck here -- for a few minutes, then goes through, then gets stuck, then continues, then gets stuck. Occasionally it's successful. – James S Oct 11 '19 at 0:40
1

I remember facing the same issue when using UseDNS yes in my sshd config, try setting it to no and hopefully it'll resolve your problem

if your ISP gives IPs without rDNS this usually happens

how to know if your IP has a reverse DNS record? visit www.whatismyip.com or similar and take the IP then run host 1.1.1.1 where 1.1.1.1 is your IP and see if it gives a reply back, if it doesn't like when you host 11.11.11.11 then your ISP doesn't set rDNS records

bashar@bashar-ThinkPad-W520:~$ host 1.1.1.1
1.1.1.1.in-addr.arpa domain name pointer one.one.one.one.

bashar@bashar-ThinkPad-W520:~$ host 11.11.11.11
Host 11.11.11.11.in-addr.arpa. not found: 3(NXDOMAIN)

Additionally, you may want to look at GSSAPIAuthentication no or test it by adding -u0 to your ssh command

| improve this answer | |
  • Just wanted to note, option -u0 on OpenSSH_8.3p1, OpenSSL 1.1.1g 21 Apr 2020 tells me "ssh: unknown option -- u" – sdbbs Aug 28 at 7:42

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.