ssh: Read from socket failed: Connection reset by peer

Protecting your Linux box

ssh: Read from socket failed: Connection reset by peer

Postby waqaskhawaja » Sun Apr 01, 2007 7:28 pm

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
waqaskhawaja
Lance Naik
 
Posts: 44
Joined: Thu Aug 31, 2006 8:52 pm
WLM: w_kh@hotmail.com
Yahoo Messenger: waqas.khawaja@yahoo.com
Location: Lahore Pakistan

Postby hamdan » Wed Apr 04, 2007 12:12 pm

may be u left it inactive for a while... server usually kicks u out in these situations
hamdan
Lance Naik
 
Posts: 47
Joined: Mon Jul 05, 2004 4:15 pm

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

Postby lambda » Wed Apr 04, 2007 1:43 pm

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
lambda
Major General
 
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Website: http://www.hungry.com/~fn/
Location: Lahore

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

Postby waqaskhawaja » Wed Apr 04, 2007 8:34 pm

lambda wrote:how long does it take for that disconnection message to appear?

it appeared almost instantly.

It works now.
waqaskhawaja
Lance Naik
 
Posts: 44
Joined: Thu Aug 31, 2006 8:52 pm
WLM: w_kh@hotmail.com
Yahoo Messenger: waqas.khawaja@yahoo.com
Location: Lahore Pakistan

Re:

Postby LinuxFreaK » Fri Apr 06, 2007 12:17 pm

Dear waqaskhawaja,
Salam,

Must be your firewall.

Best Regards.
Farrukh Ahmed
LinuxFreaK
Site Admin
 
Posts: 5132
Joined: Fri May 02, 2003 10:24 am
ICQ: 82075802
Website: http://www.linuxpakistan.net/wiki/index.php?pagename=LinuxFreak
WLM: f4fahmed@hotmail.com
Yahoo Messenger: f4fahmed@yahoo.com
AOL: linuxpakistan@aol.com
Location: Karachi

Postby waqaskhawaja » Fri Apr 06, 2007 11:44 pm

I don't think so because it showed "Connection established" before "Connection reset by peer"
waqaskhawaja
Lance Naik
 
Posts: 44
Joined: Thu Aug 31, 2006 8:52 pm
WLM: w_kh@hotmail.com
Yahoo Messenger: waqas.khawaja@yahoo.com
Location: Lahore Pakistan

Re:

Postby LinuxFreaK » Sat Apr 07, 2007 10:59 am

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
LinuxFreaK
Site Admin
 
Posts: 5132
Joined: Fri May 02, 2003 10:24 am
ICQ: 82075802
Website: http://www.linuxpakistan.net/wiki/index.php?pagename=LinuxFreak
WLM: f4fahmed@hotmail.com
Yahoo Messenger: f4fahmed@yahoo.com
AOL: linuxpakistan@aol.com
Location: Karachi


Return to “%s” Security

Who is online

Users browsing this forum: No registered users and 1 guest

cron