ssh: Read from socket failed: Connection reset by peer

Protecting your Linux box
Post Reply
waqaskhawaja
Lance Naik
Posts: 44
Joined: Thu Aug 31, 2006 8:52 pm
Location: Lahore Pakistan
Contact:

ssh: Read from socket failed: Connection reset by peer

Post by waqaskhawaja »

I receive the following error when I try to connect to a machine using ssh.

Code: Select all

OpenSSH_4.2p1 Debian-7ubuntu3.1, OpenSSL 0.9.8a 11 Oct 2005
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 172.16.1.1 [172.16.1.1] port 22.
debug1: Connection established.
debug1: identity file /home/waqas/.ssh/identity type -1
debug1: identity file /home/waqas/.ssh/id_rsa type -1
debug1: identity file /home/waqas/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3p2 Debian-5ubuntu1
debug1: match: OpenSSH_4.3p2 Debian-5ubuntu1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.2p1 Debian-7ubuntu3.1
debug1: SSH2_MSG_KEXINIT sent
Read from socket failed: Connection reset by peer
sshd_config of the host running openssh-server

Code: Select all

# Package generated configuration file
# See the sshd(8) manpage for details

# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 768

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
PermitRootLogin no
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile	%h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
#Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server

UsePAM yes
hamdan
Lance Naik
Posts: 47
Joined: Mon Jul 05, 2004 4:15 pm

Post by hamdan »

may be u left it inactive for a while... server usually kicks u out in these situations
lambda
Major General
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Location: Lahore
Contact:

Re: ssh: Read from socket failed: Connection reset by peer

Post by lambda »

how long does it take for that disconnection message to appear? what do the logs say? what happens when you run

Code: Select all

sshd -p 2000 -Dddd
and

Code: Select all

ssh -p 2000 server
waqaskhawaja
Lance Naik
Posts: 44
Joined: Thu Aug 31, 2006 8:52 pm
Location: Lahore Pakistan
Contact:

Re: ssh: Read from socket failed: Connection reset by peer

Post by waqaskhawaja »

lambda wrote:how long does it take for that disconnection message to appear?
it appeared almost instantly.

It works now.
LinuxFreaK
Site Admin
Posts: 5132
Joined: Fri May 02, 2003 10:24 am
Location: Karachi
Contact:

Re:

Post by LinuxFreaK »

Dear waqaskhawaja,
Salam,

Must be your firewall.

Best Regards.
Farrukh Ahmed
waqaskhawaja
Lance Naik
Posts: 44
Joined: Thu Aug 31, 2006 8:52 pm
Location: Lahore Pakistan
Contact:

Post by waqaskhawaja »

I don't think so because it showed "Connection established" before "Connection reset by peer"
LinuxFreaK
Site Admin
Posts: 5132
Joined: Fri May 02, 2003 10:24 am
Location: Karachi
Contact:

Re:

Post by LinuxFreaK »

Dear waqaskhawaja,
Salam,

If you are sure then you must take a look into /etc/hosts.allow and /etc/hosts.deny also take a look into /var/log/secure.

Best Regards.
Farrukh Ahmed
Post Reply