Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have problem connecting to host via ssh. It prompts me this error :

debianbox@debian:~$ssh cdcharles@hephaistos.rsr.lip6.fr
ssh_exchange_identification : Connection closed by remote host

The problem is that I used to connect to that machine before with the same account, but now I don't know what happen I just get this error. I try to warn the admin but he says that everything works fine. Can somebody tells me what is the problem?

share|improve this question
is the ssh server running something like denyhosts? Have you tried SSH'ing in from a different IP? – Chad Feller Sep 3 '11 at 18:04
No I did not try. – Dimitri Sep 3 '11 at 18:06
If there is something like denyhosts running, it will temporarily (or permanently, depending on configuration) blacklist your IP (for incoming SSH), by putting an entry in /etc/hosts.deny Your output above is consistent with this scenario. Try to confirm this by SSH'ing to that box from another (external) IP. If you don't have more than one external IP, SSH into another offsite box then SSH into the box in question. – Chad Feller Sep 3 '11 at 18:51
Run ssh -vvv … and post the output, so we know at what point the remote host closes the connection. – Gilles Sep 4 '11 at 18:06
Probably you are really running denyhost or something similar, because the first time I tried to log I could type a password. After typing wrong passwords voluntarily, I could not see the same login message. The same issue appears with different IPs. – lcipriani Sep 5 '11 at 16:06
up vote 2 down vote accepted

You mentioned in the comments that connecting from other addresses works, so most likely you have something like denyhosts running. Denyhosts detects failed SSH attempts and (if there are too many) blocks connections from that address. Check your /etc/hosts.deny file to see if your machine's IP address is in there, and remove it if so. You can add it to /etc/hosts.allow if you like, so it will always be able to connect even if Denyhosts blocks it again

(Adapted from several comments on the question)

share|improve this answer

It means that the initial SSH handshake isn't completing properly. There could be several reasons for this, but in my experience it was because the SSH listening service has crashed. The socket opens, but it can't talk SSH inside the socket.

What kind of device are you connecting to? Do you have a way to restart SSH without logging in via SSH?

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.