Can't connect with putty to a Linux server

33,057

Solution 1

It was denyhost that added me to the denylist. I could log into my server with little help from my isp and I have permanently added me to the hosts.allow list. But it can also be the ssh-key has not been properly deleted with rm -f ~/.ssh/known_hosts because after I use the alternate login method I get this error message:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is...

and I was forced to delete the key with ssh-keygen -R www.example.com-f /root/.ssh/known_hosts. rm -f ~/.ssh/known_hosts didn't work for me?

Solution 2

Sounds like you do not have OpenSSH-Server installed on the linux box. On debian base, do sudo apt-get install openssh-server and then retry the connection. Do you have a firewall enabled on the linux box?

How many failed login attempts did you make from this computer? I guess fail2ban is blocking that computer?

http://webcache.googleusercontent.com/search?q=cache:FeZUrSwcKqMJ:debianclusters.org/index.php/Fail2Ban:_Preventing_Brute_Force_SSH+&cd=1&hl=en&ct=clnk&gl=us&client=firefox-a

Solution 3

Is there an /etc/hosts.allow or /etc/hosts.deny file that you have to work with? It's possible that it's not Putty at all and your WinPC is on the deny list or the Linux client that works is on the allow list.

Share:
33,057

Related videos on Youtube

Micromega
Author by

Micromega

Professional CMS TYPO3 and Full Stack developer. If my answer is helpful please consider to donate: eth:0x6a0c4dda92ace3ec82fb4a2810091fd17539edb6 Fashionreps WatchExchange phpclasses Jsclasses Codeplex Github I am nerdier than 44% of all people. Are you a nerd? Click here to take the Nerd Test, get nerdy images and jokes, and write on the nerd forum! #SOreadytohelp

Updated on September 18, 2022

Comments

  • Micromega
    Micromega over 1 year

    I can't connect with Putty to a Linux box. In the putty log I only get 3 lines and the last line is "Server unexpectedly closed network connection". FTP and ping to the Linux box works. Putty is resolving host name either. Is there a special service I need to enable with putty and ssh? Ssh is working from a Linux client.

    I get ssh_exchange_identifaction error. FTP is working though.

     ssh -vvv [email protected]
     OpenSSH_5.1p1  Debian-6.maemo5, OpenSSL 0.9.8n 24 Mar 2010
     debug1: Reading configuration data /etc/ssh/ssh_config
     debug1: Applying options for *
     debug2: ssh_connect: needpriv 0
     debug1: Connecting to www.host.com [99.99.999.999] port 22.
     debug1: Connection established.
     debug1: permanently_set_uid: 0/0
     debug1: identity file /root/.ssh/identity type -1
     debug1: identity file /root/.ssh/id_rsa type -1
     debug1: identity file /root/.ssh/id_dsa type -1
     ssh_exchange_identification: Connection closed by remote host
    
    • kobaltz
      kobaltz over 12 years
      try to delete your known hosts in ~/.ssh
    • Ƭᴇcʜιᴇ007
      Ƭᴇcʜιᴇ007 over 12 years
      Related: Connection closed by remote host - Perhaps 'too many connections'? Have you checked the logs, and/or tried resetting the SSH daemon on the server?
    • Micromega
      Micromega over 12 years
      @techie007: ftp into server works but not ssh. Is is overload or an attack? What now?
    • Ƭᴇcʜιᴇ007
      Ƭᴇcʜιᴇ007 over 12 years
      Ensure you're not logged into the server more than once, and/or ensure the SSH daemon/System is configured to allow you more than one concurrent connection, and as I asked/suggested before... Have you checked the logs, and/or tried resetting the SSH daemon on the server? :)
    • Micromega
      Micromega over 12 years
      @techie007: Hmm, it's virtuel server. I've installed the box myself. Never ever happend this. I report latet to you. Thanks!
    • Mughil
      Mughil over 12 years
      Once you reboot the server, i can assure that the error will be gone. Here is the useful link regarding this topic.
  • Micromega
    Micromega over 12 years
    ssh is working from a Linux client. I remember it worked with Windows but I've disabled some services and I can't remember which one is important?
  • Micromega
    Micromega over 12 years
    It's the same box i.e. connection. I disabled some services but I don't know what service is important for putty and ssh?
  • Yitzchak
    Yitzchak over 12 years
    Can't help you there, sorry. Windows networking is a woeful (or not) gap in my education.