ssh closes unexpectedly, but why?

michaelsanford

Translator, Web Developer
I have public key authentication enabled, and it has worked on thousands of previous tries.

I think I may have upgraded something on my slackware machine (target host) that buggered it, though the configuration files are untouched.

Here's the debug output when trying to connect
Code:
localhost:~ user$ ssh -v slackware
OpenSSH_5.1p1, OpenSSL 0.9.7l 28 Sep 2006
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to slackware [192.168.1.XXX] port 22.
debug1: Connection established.
debug1: identity file /Users/user/.ssh/identity type -1
debug1: identity file /Users/user/.ssh/id_rsa type 1
debug1: identity file /Users/user/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1
debug1: match: OpenSSH_5.1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc 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: Host 'slackware' is known and matches the RSA host key.
debug1: Found key in /Users/user/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
Connection closed by 192.168.1.XXX
There's no useful information in slackware's /var/log/syslog
 
I'd suggest firing up another instance on sshd on your slackware with debug enabled, e.g.:

/usr/sbin/sshd -d -d -d -p 8022

Then on your client do:

ssh -v -v -v -p 8022 slackware.

Somewhere in the debug output of the server or client should lie the answer.

Another idea, maybe a longshot, you say after an upgrade the config files are unchanged -- you mean the sshd config files? But has anything changed in your environment on the slackware machine (changes to .bashrc, .profile etc.?). You might try moving all such config files aside and trying again? Also check that your shell in /etc/passwd is defined properly, and isn't (as I've seen on older machines at work) something like /usr/bin/tcsh instead of /bin/tcsh....
 
If you've upgraded Slackware, check to make sure there isn't a backed-up sshd_config sitting in the same directory as the current one. If you've set keepalives to prevent the disconnections in the past, it's possible that the new configuration doesn't have this set as of the upgrade.
 
nixgeek, that's one of the first things I checked. No dice. Thanks though!

macbri, I tried that. I then ssh'd into my server but forgot to add the port specifier, and to my amazement it worked without a hitch (on the default port).

I have changed nothing on either machine, not even rebooted them, nor have I reset my router, but it magically works now. Ghost in the machine…

Thanks for your replies!
 
Back
Top