"Read from socket failed: Connection reset by peer" error with ssh and sftp

by Ram   Last Updated December 01, 2015 09:00 AM

I have created keygen and public key I have copied to the remote host. First day it worked fine without any issue, I could transfer the files from my host to remote host with out prompting me for password. Next day during the batch sftp jobs failed and i tried manually connecting to remote host. It is throwing me this particular error:

[[email protected] dbconfig]$ ssh '[email protected]' Read from socket failed: Connection reset by peer

I am unable to understand where the issue is exactly.

If i do ssh -v on remote host i get below details.

[[email protected] ssh]$ ssh -vvv '[email protected]' 
OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010 
debug1: Reading configuration data /etc/ssh/ssh_config 
debug1: Applying options for * debug2: ssh_connect: needpriv 0 
debug1: Connecting to 192.168.248.30 [192.168.248.30] port 22. 
debug1: Connection established. 
debug1: identity file /home/murex/.ssh/identity type -1 
debug3: Not a RSA1 key file /home/murex/.ssh/id_rsa. 
debug2: key_type_from_name: unknown key type '-----BEGIN' 
debug3: key_read: missing keytype 
debug3: key_read: missing whitespace 
debug3: key_read: missing whitespace 
debug3: key_read: missing whitespace 
debug3: key_read: missing whitespace 
debug3: key_read: missing whitespace 
debug3: key_read: missing whitespace 
debug3: key_read: missing whitespace 
debug3: key_read: missing whitespace 
debug3: key_read: missing whitespace 
debug3: key_read: missing whitespace 
debug3: key_read: missing whitespace 
debug3: key_read: missing whitespace 
debug3: key_read: missing whitespace 
debug3: key_read: missing whitespace 
debug3: key_read: missing whitespace 
debug3: key_read: missing whitespace 
debug3: key_read: missing whitespace 
debug3: key_read: missing whitespace 
debug3: key_read: missing whitespace 
debug3: key_read: missing whitespace 
debug3: key_read: missing whitespace 
debug3: key_read: missing whitespace 
debug3: key_read: missing whitespace 
debug3: key_read: missing whitespace 
debug3: key_read: missing whitespace 
debug2: key_type_from_name: unknown key type '-----END' 
debug3: key_read: missing keytype 
debug1: identity file /home/murex/.ssh/id_rsa type 1 
debug1: identity file /home/murex/.ssh/id_dsa type -1 
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2 
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2 pat OpenSSH* 
debug1: Enabling compatibility mode for protocol 2.0 
debug1: Local version string SSH-2.0-OpenSSH_5.3 
debug2: fd 3 setting O_NONBLOCK 
debug1: SSH2_MSG_KEXINIT sent 
debug3: Wrote 792 bytes for a total of 813

Kindly please help me in resolving this.

Regards, Ram

Tags : linux ssh sftp


Answers 2


Your local id_rsa private key seems to be not valid. You could look at it using:

cat ~/.ssh/id_rsa

And see if it looks ok. Did you generate this file, or was it copied from some other machine?

Worst case you should generate a new private/public key pair and redo the copy with

ssh-copy-id [[email protected]]machine
Olaf Achthoven
Olaf Achthoven
December 01, 2015 08:19 AM

Thanks Olaf & Marius, The issue was with ssh service running on the server. SO we have restarted the ssh service and issue the issue got resolved. Becauase of ssh service issue even it was not prompting for password when I was trying to transfer the public key.

Ram
Ram
December 02, 2015 06:23 AM

Related Questions



I want to copy files from SFTP to another server

Updated April 30, 2017 01:01 AM

SFTP mirroring from server to linux machine

Updated November 30, 2017 08:01 AM

How do I get an entire directory in sftp?

Updated September 14, 2018 16:01 PM