Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Yesterday I was migrating to my new server, needed to use rsync, I created a RSA key, so that rsync could connect, I saw an error that says add to trusted key in location x I didn't have that location on my new server, so basically when I do mv rsakey /location.x The directory didn't exist.

I tried regenerating the key. but that didn't help, now I'm unable to login to ssh nor to filezilla scp protocol it says

Error: Network error: Software caused connection abort. Error: Could not connect to server

I'm almost certain that the error is caused by RSA key. How can I fix it? By the way I have Ispcp installed, so I might be able to fix it from there.

Note: I have generated RSA keys on the old and the new server, I can login to the old but not the new one.


using terminator on ubuntu 12.04:

$ ssh root@server_ip
Connection closed by server_ip


after doing mv ~/.ssh ssh_backup i tried to connect and it says Read from socket failed: Connection reset by peer i retried and it gave me the connection closed error shown above


the output of ssh -vv root@server_ip

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 *
debug2: ssh_connect: needpriv 0
debug1: Connecting to my_ip_address [my_ip_address] port 22.
debug1: Connection established.
debug1: identity file /home/me/.ssh/id_rsa type -1
debug1: identity file /home/me/.ssh/id_rsa-cert type -1
debug1: identity file /home/me/.ssh/id_dsa type -1
debug1: identity file /home/me/.ssh/id_dsa-cert type -1
debug1: identity file /home/me/.ssh/id_ecdsa type -1
debug1: identity file /home/me/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.5p1 Debian-6+squeeze3
debug1: match: OpenSSH_5.5p1 Debian-6+squeeze3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
Connection closed by my_ip_address

@mattdm I named the location x because i forgot what it was, you know that error where it basically says: please move rsa key to trusted sources location, or something like that. maybe it was /.ssh

share|improve this question
Can you be more specific about "location.x"? Was this in /etc or in root's home directory? – mattdm Apr 2 '13 at 17:40
Note that a key error will generally give you permission denied from ssh, not the connection errors you are seeing. Can you run (from your ubuntu client) ssh -vv root@server_ip? The -vv will add debugging output. – mattdm Apr 2 '13 at 17:42
needed to use rsync, I created a RSA key. Are we talking about a host key or a user key? And on which server did you put it? Which server gave you that "add to trusted key" error. Then as mattdm asked, what is "location.x" (again, which server). Be explicit. – Patrick Apr 2 '13 at 18:05
@Patrick please read my edit sir, and my new debian server gave me the error, i was using rsync on the old one, trying to connect to the new one... we are talking about host key – Lynob Apr 2 '13 at 18:12
Okay, now it's time to look in your server logs. The connection-closed after SSH2_MSG_KEXINIT is _very early in the process. Something is almost certainly messed up in /etc. – mattdm Apr 2 '13 at 20:26

One, rather drastic, way of fixing this would be to delete your ssh credentials. On your local machine:

mv ~/.ssh ssh_backup

Then try to ssh into the server again, it should ask for a password. You can now restart the process of generating RSA keys.

share|improve this answer
on my local machine? you mean i should do mv ~/.ssh ssh_backup on my pc? – Lynob Apr 2 '13 at 16:55
what if my pc is windows? – Lynob Apr 2 '13 at 16:59
Then you are posting on the wrong forum. There will probably be an equivalent directory under windows but I really don't know. I would recommend you flag your question and ask a mod to migrate to superuser. – terdon Apr 2 '13 at 17:01
i have ubuntu 12.04 installed as well so i can do it from there, i use terminator shell, is it .ssh ssh_backup on ubuntu? – Lynob Apr 2 '13 at 17:07
You should do it on the machine you cannot connect from. If I have understood your problem correctly, you have generated an incorrect RSA key and ssh is trying to use it to identify you to your server. If you delete your local key, it should ask you for a password again and allow you to connect. If you cannot connect from windows but you can connect from Linux (or vice versa) then the problem is with the server, not your local machine and what I suggest will not work. – terdon Apr 2 '13 at 17:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.