ssh connection being closed
Im wondering if anyone can help me…
If i ssh into my linode, ie.. into li-*.members.linode.com the connection is closed by the host instantly (ie.. before I even have ssh'd in).
I've been doing a couple of reboots lately because i have been fideling with my disk images, but now can't ssh in.
If i go in using the console its fine.
Im using the redhat distro small.
Thanks
Alex
5 Replies
What does /var/log/messages and /var/log/secure show when you attempt to ssh in?
[root@li-* config]# ssh -v li-*.members.linode.com
OpenSSH_3.5p1, SSH protocols 1.5/2.0, OpenSSL 0x0090701f
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Rhosts Authentication disabled, originating port will not be trusted.
debug1: ssh_connect: needpriv 0
debug1: Connecting to li-.members.linode.com [64.5.53.] port 22.
debug1: Connection established.
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
debug1: Remote protocol version 1.99, remote software version OpenSSH_3.5p1
debug1: match: OpenSSH_3.5p1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_3.5p1
debug1: SSH2MSGKEXINIT sent
Connection closed by 64.5.53.*
debug1: Calling cleanup 0x80674e0(0x0)
For the other two calls, the files didnt exist, so I touched them, then tail -f the files while I try'ed to log in, but nothing happend. Did you mean watch them while I run ssh -v? or try and ssh in from my linode?
Thanks
Alex
Log into your Linode via the console. Stop sshd (/etc/network/sshd stop, or whatever).
Then, run sshd in debug mode:
[linode]# sshd -d
It will start to spew out debug info, eventually waiting for a connection.
From another machine, attempt to ssh like normal into your Linode. The debug output via the console might give you an idea of what the problem is.
-Chris
For example this is what I had to do to fix my ssh problem.
[root@amcms root]# /usr/sbin/sshd -d
debug1: sshd version OpenSSH_3.5p1
debug1: private host key: #0 type 0 RSA1
debug1: read PEM private key done: type RSA
debug1: private host key: #1 type 1 RSA
debug1: read PEM private key done: type DSA
debug1: private host key: #2 type 2 DSA
Missing privilege separation directory: /var/empty/sshd
So I made the directory /var/empty/sshd then..
[root@amcms root]# /usr/sbin/sshd -d
debug1: sshd version OpenSSH_3.5p1
debug1: private host key: #0 type 0 RSA1
debug1: read PEM private key done: type RSA
debug1: private host key: #1 type 1 RSA
debug1: read PEM private key done: type DSA
debug1: private host key: #2 type 2 DSA
debug1: Bind to port 22 on ::.
debug1: Bind to port 22 on 0.0.0.0.
Bind to port 22 on 0.0.0.0 failed: Address already in use.
Cannot bind any address.
So then I killed all sshd processes (there was only one). Then ran /usr/bin/sshd -e again
After this I was then able to login.. However it then complained that /var/log/lastlog did not exist, so I touched that. Now it seems like its working ok.
However what I would really like to know is why this would of occured in the first place?
@zan:
i can't just do a clean install (which I would really like to do as there has been heaps of stuff going wrong…) as i have sites up on it now…
If you have any unused disk space you could do a fresh OS install into that, and mount that into your existing OS. This would, at least, let you compare a fresh install against your running version to work out what is wrong.
You'd probably need to reboot to make the new image available in your OS profile.