Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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've run into a problem with ssh that has me completely stumped (and our department IT guy as well): Up until a few days ago I had no problems accessing my files on our departmental server (university math department, running Scientific Linux) using SSH from my Ubuntu box at home, and I had no problems mounting my user directory at work as a network drive.

As of a couple of days ago, running ssh user@hostname.tld returns

ssh_exchange_identification: Connection closed by remote host

Running ssh -v hostname.tld returns

OpenSSH_6.1p1 Debian-4, OpenSSL 1.0.1c 10 May 2012

debug1: Reading configuration data /etc/ssh/ssh_config   
debug1: /etc/ssh/ssh_config line 19: Applying options for *  
debug1: Connecting to [] port 22.  
debug1: Connection established.    
debug1: identity file /home/sean/.ssh/id_rsa type -1  
debug1: identity file /home/sean/.ssh/id_rsa-cert type -1  
debug1: identity file /home/sean/.ssh/id_dsa type -1  
debug1: identity file /home/sean/.ssh/id_dsa-cert type -1  
debug1: identity file /home/sean/.ssh/id_ecdsa type -1  
debug1: identity file /home/sean/.ssh/id_ecdsa-cert type -1  
ssh_exchange_identification: Connection closed by remote host  

and trying to mount the network folder gives

Oops! Something went wrong. Unhandled error message: SSH program unexpectedly exited

In fact I'm not even able to successfully ping the server.

My first thought was that either the server was down, or I had some sort of incorrect firewall setting (although I had not made any changes to the firewall or router). It's not a problem connecting via SSH through my router/firewall though, since I can connect to other servers via SSH (I still have access to my account on the server at my last department), and the server I want to connect to is still up, since I can connect as follows: 1. SSH into old server. 2. From old server, SSH into new server.

However, I can't log into the new server directly. I'm completely stumped. Any ideas?

share|improve this question

I frequently use services like fail2ban or denyhosts to monitor for invalid login attempts (usually dictionary attacks) and ban the clients' addresses.

They typically work by adding the client address to /etc/hosts.deny, at which point you'll see the types of failures you're describing here, including the "ssh_exchange_identification: Connection closed by remote host" message when using ssh -v .

It's worth checking whether your client address is in /etc/hosts.deny and if a service like denyhosts is running.

share|improve this answer
Thanks. I've sent my current IP address to the guy running our server to see if it's been blacklisted. The only guess we've come up with so far is that I was assigned a new dynamic IP address from my ISP, and they gave me one that was previously banned for port scans or repeated login failures, since everything worked fine until a few days ago. – Sean Fitzpatrick Oct 2 '13 at 3:14

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.