Logo Background

SSH Connection Closed By Remote Host

  • By on June 20, 2010 | 2 Comments

    Our SFTP batch job fails with the error message ssh_exchange_identification: Connection closed by remote host when connecting the destination server for downstream interface.

    The SSH connection error is intermittent and happens on and off making it difficult to troubleshoot.

    You can do a manual connection from your Unix shell using the SSH command as below.

    $ ssh remote_ip or remote_hostname
    ssh_exchange_identification: Connection closed by remote host
     
    $ ssh -v remote_ip or remote_hostname
    OpenSSH_3.6.1p2, SSH protocols 1.5/2.0, OpenSSL 0x0090702f
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: Applying options for *
    debug1: Connecting to <remote_ip> [<remote_ip>] port 22.
    debug1: Connection established.
    debug1: identity file /home/username/.ssh/identity type -1
    debug1: identity file /home/username/.ssh/id_rsa type -1
    debug1: identity file /home/username/.ssh/id_dsa type -1
    ssh_exchange_identification: Connection closed by remote host
    debug1: Calling cleanup 0x80627f0(0x0)

    At first we thought the problem was caused by either /etc/hosts.allow or /etc/hosts.deny but the entry inside the files looks good.

    We suspect the destination server which was used by other system for interface as well could not cope the number of SSH connection.

    The parameter MaxStartups in the files /etc/ssh/sshd_config determine the number of maximum connection allowed for SSH.

    $ grep MaxStartups /etc/ssh/sshd_config
    MaxStartups 20

    The existing parameter shows that maximum 20 connection and any more new connection beyond will be blocked.

    We increase the maximum number connection to 40 and continue to monitor the downstream batch job.

    The maximum number of connection might be different on your system requirement case. Contact the system administrator and get their advice before making any change on the sshd_config file.

    Previous
    Next
    » ORA-01031 Insufficient Privileges
  1. #1 Ryan
    September 5, 2012 9:22 pm

    I am getting the SSH connection closed error message as well. As checked on the /var/log/messages, this is what I got.

    Sep 6 07:03:48 ftp-node1 xinetd[4980]: Deactivating service ssh due to excessive incoming connections. Restarting in 10 seconds.
    Sep 6 07:03:48 ftp-node1 xinetd[4980]: Deactivating service ssh due to excessive incoming connections. Restarting in 10 seconds.
    Sep 6 07:09:48 ftp-node1 xinetd[4980]: Deactivating service ssh due to excessive incoming connections. Restarting in 10 seconds.

    The solution is to increase the CPS setting in /etc/xinetd.conf.

    Post ReplyPost Reply
Leave a Comment