Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

We have a server XXX ON Amazon EC2.

SSH is running on a standard (22) port.

I placed my pubkey at the /.ssh/authorized_keys file

The fun thing is that YESTERDAY it was working great!

But today, I don't know what happened! I just can't log in.

ssh -vvvv servername

is stuck on

debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY

I checked my pubkey and it's there! (how I checked?? I asked the other guy to check)

and then I used another computer (windows 7 + putty) and placed my new pubkey. ANd what? I was able to log in! And that's another computer with Win7 is ont the same LAN which menas that the external IP is the same.

My private key works for other servers but not with this.

This thing is killing me )))))

Absolutely strange.

Please help!

share|improve this question
I generated NEW keys and stored new pubkey..the same thing! ha! –  bakytn Dec 8 '10 at 12:48
fyi, your problem has nothing to do with pubkey authentication: the DH key exchange (SSH2_MSG_KEX_DH_GEX_REPLY) happens much earlier in the connection. –  grawity Dec 8 '10 at 13:46
thank you for information. BTW GUYS, the problem has been resolved by itself. I didn't anything just tried to log in and I was successful. hah –  bakytn Dec 8 '10 at 16:01

4 Answers 4

up vote 2 down vote accepted

I had the same problem after I upgraded my Ubuntu client machine. I solved my problem by reducing the size of the line "Ciphers" in /etc/ssh/ssh_config. It also works if you specify the cypher in the command line (ex: ssh -c username@hostname)

Tip from here:


share|improve this answer

Bad network latency? much drops?

Its just normal message.

share|improve this answer
probably it is. I now can't reproduce it in any way. So it might from my side. –  bakytn Sep 14 '11 at 4:47


  • check your ~/.ssh/authorized_keys permission, it should be 600

  • check the on on /var/log/secure, /var/log/messages or /var/log/auth

share|improve this answer

Change the network interface MTU to solve it. This is a bug for ubuntu 14.04.

This worked for me:

sudo ip li set mtu 1200 dev wlan0

ssh fails to connect to VPN host - hangs at 'expecting SSH2_MSG_KEX_ECDH_REPLY'

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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