Error: SSH clossing connection after successful authentication

Posted on

I have experiencing the issue with SSH, that cause closing connection after the successful authentication. But I didn’t see any thing in the log moreover it is a Cpanel server

I suspected this would be the problem with profile setting, after goggling for hours I got the solution, in  cpanel server their was an autofix script,

Download script from here :-
http://httpupdate.cpanel.net/autofixer/safesshrestart
Or
You may execute the script direct via WHM
http://x.x.x.x:2086/scripts2/autofixer (Replace x.x.x.x with the server IP address)

Verbose output will be like this :

anand@test-desktop:~$ ssh -v root@11.222.333.444
OpenSSH_5.9p1 Debian-5ubuntu1, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 11.222.333.444 [11.222.333.444] port 22.
debug1: Connection established.
debug1: identity file /home/anand/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/anand/.ssh/id_rsa-cert type -1
debug1: identity file /home/anand/.ssh/id_dsa type -1
debug1: identity file /home/anand/.ssh/id_dsa-cert type -1
debug1: identity file /home/anand/.ssh/id_ecdsa type -1
debug1: identity file /home/anand/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 1.99, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA 29:b6:2b:c9:4e:82:9d:22:6c:2b:c4:0d:61:10:b4:a5
debug1: Host '202.228.207.91' is known and matches the RSA host key.
debug1: Found key in /home/anand/.ssh/known_hosts:115
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/anand/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: /home/anand/.ssh/id_dsa
debug1: read PEM private key done: type DSA
debug1: Authentication succeeded (publickey).
Authenticated to 11.222.333.444 ([11.222.333.444]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US
Last login: Thu Apr 11 06:21:46 2013 from 222.200.211.111
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
debug1: channel 0: free: client-session, nchannels 1
Connection to 11.222.333.444 closed.
Transferred: sent 3424, received 2296 bytes, in 469.7 seconds
Bytes per second: sent 7.3, received 4.9
debug1: Exit status 0

I ran the below steps to fix this issue :

[root@svl3 ~]# wget http://httpupdate.cpanel.net/autofixer/safesshrestart
--2013-04-11 06:18:15-- http://httpupdate.cpanel.net/autofixer/safesshrestart
Resolving httpupdate.cpanel.net... 69.72.212.11, 70.87.220.252, 72.233.42.250, ...
Connecting to httpupdate.cpanel.net|69.72.212.11|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2985 (2.9K) [application/octet-stream]
Saving to: “safesshrestart”
100%[====================================================================================================>] 2,985 13.7K/s in 0.2s
2013-04-11 06:18:15 (13.7 KB/s) - “safesshrestart” saved [2985/2985]
[root@svl3 ~]# chmod +x safesshrestart
[root@svl3 ~]# ./safesshrestart 
Attempting to locate sshd binaries installed on the system ...<br />
Located /usr/sbin/sshd<br />
Done.<br />
Killing exisiting sshd processes...<br />
Stopping sshd: [ OK ]
<br />
Done.<br />
configuring sshd to run on port 22<br />
/usr/sbin/sshd successfully started!<br />
root 3068 0.0 0.0 64164 1060 ? Rs 06:19 0:00 /usr/sbin/sshd -f /var/cpanel/safe_sshd
<br />
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s