If I try to ssh into my raspberry pi (raspbian, latest version), it just hangs

ssh pi@74.198.xx.xx -p 22xx

edit (added -v arg as per suggestion)

ssh pi@74.198.xx.xx -p 22xx -v
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: /etc/ssh_config line 53: Applying options for *
debug1: Connecting to 74.198.xx.xx [74.198.xx.xx] port 22xx.
debug1: Connection established.
debug1: identity file /Users/michael/.ssh/id_rsa type -1
debug1: identity file /Users/michael/.ssh/id_rsa-cert type -1
debug1: identity file /Users/michael/.ssh/id_dsa type -1
debug1: identity file /Users/michael/.ssh/id_dsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.0p1 Debian-4
debug1: match: OpenSSH_6.0p1 Debian-4 pat OpenSSH*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP

hangs here

So clearly something is sort of working, but I am a bit stumped as to why ssh just hangs.

Any ideas?

The raspberry pi is very remote (as in a 4 hour drive away in a secluded location with no personnel), so I cannot diagnose locally.

  • Try using the -v flag in ssh. It might show something useful: ssh pi@74.198.xx.xx -p 22xx -v – foibs Dec 25 '13 at 0:03
  • sheez, what nefarious plans do you have for your pi :P – feverDream Dec 25 '13 at 5:05
  • Its supposed to be controlling a bunch of IP cameras for tracking wildlife. The raspberry pi continually grabs snapshots and stores them for uploading. It is quite remote. – michael Dec 25 '13 at 7:45
  • This has to be a problem with the client (your PC) and not the server (Raspberry). Can you try sshing with another machine? Also please post your ssh client config. On most distros it is located in /etc/ssh/ssh_config – foibs Dec 25 '13 at 11:00

Edit the following configuration files for the Raspberry Pi:


And add the following line to the bottom of the configuration file:

IPQoS 0x00

And restart sshd (sudo service sshd restart).

Found the solution here - https://expresshosting.net/ssh-hanging-authentication/

  • I had seen several versions of this. It fixed my problem on a raspberry pi zero wh, Linux raspberrypi 4.14.98+. – Erik Garrison May 19 '19 at 19:26

Have you enabled ssh in raspbian? This is disabled by default.

You can set it in Advanced Options in raspi-config

I am rather surprised that telnet is enabled - this is insecure.

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.