LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-19-2009, 09:50 PM   #1
hattori.hanzo
Member
 
Registered: Aug 2006
Posts: 168

Rep: Reputation: 15
ssh session automatically closing


We have encountered a very strange issue with OpenSSH on CentOS 5.2 (openssh-server-4.3p2-26.el5_2.1). On one of our hosts, the ssh sessions are being closed automatically for no apparent reason with the following message:

Quote:
Read from remote host server.com: Connection reset by peer
Connection to server.com closed.
If we try and reconnect we get
Quote:
ssh: connect to host server.com port 22: Connection refused
If we check the port, it shows its closed

Quote:
PORT STATE SERVICE
22/tcp closed ssh
We have checked the following:
  • iptables is stopped
  • hosts.allow - no entries
  • hosts.deny - no entries
  • erased openssh
  • re-installed openssh (used default sshd_config)

The port appears to close for like 5 mins, then re-opens again.

All the previous sessions then remains open on the system.

Quote:
03:40:24 up 1:19, 4 users, load average: 0.17, 0.05, 0.01
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 server2.com 02:41 56:02 0.01s 0.01s -bash
root pts/1 server2.com 02:25 53:13 0.00s 0.00s -bash
root pts/2 server2.com 03:07 11:56 0.01s 0.01s -bash
root pts/3 server2.com 03:40 0.00s 0.01s 0.00s w
We have run out of ideas and might rebuild the box soon.

regards
 
Old 01-19-2009, 10:07 PM   #2
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
I've seen some (not all) of this behavior when I am sitting behind a NAT device, accessing a remote host. After a certain idle period, I get disconnected - but the ssh session is still active on the host.

Try setting ServerAliveInterval 90 in ~/.ssh/config on the client side for the user you're running as. For more details, see the manpages for ssh_config(5).
 
Old 01-19-2009, 11:31 PM   #3
hattori.hanzo
Member
 
Registered: Aug 2006
Posts: 168

Original Poster
Rep: Reputation: 15
Thanks for responding. I tried that but still no go...

The hosts are on the same switch so there is no nat'ing involved.

regards
 
Old 01-20-2009, 01:45 PM   #4
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Ouch. Well, what do /var/log/secure and /var/log/messages (on the server side) have to say when the sshd connection is getting disrupted?
 
Old 01-20-2009, 02:43 PM   #5
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
I kind of had this problem. Mine was due to when setting up the httpd I got interupted and placed an extra 255 in the subnet. I would connect but then it would disconnect for no reason after 5 or 10 minutes. Some times right in the middle of an edit. Does this happen on all your clients or only one?
 
Old 01-22-2009, 12:18 AM   #6
hattori.hanzo
Member
 
Registered: Aug 2006
Posts: 168

Original Poster
Rep: Reputation: 15
We finally found out the cause.

It was a conflicting IP address on the network which was causing the ssh disconnects.

Thank you for all your help and suggestions.

regards
 
1 members found this post helpful.
Old 06-16-2010, 02:35 PM   #7
mewto
LQ Newbie
 
Registered: Sep 2009
Posts: 8

Rep: Reputation: 0
Smile

I have exactly the same problem. When I saw this final resolution, I don't think that could be our problem. Well, as it turned out that I have exactly the same problem with IP conflict. A Windows admin put a new server in. The only way he check is use ping. Since this is a public facing server, I made it not ping-able. He just grab it without even checking the DNS, or the asset record. Where is the process?

There you have it. Simple solution for a puzzling problem.
 
Old 01-12-2012, 01:12 AM   #8
raseeler
LQ Newbie
 
Registered: Jan 2012
Posts: 1

Rep: Reputation: Disabled
Smile ssh session automatically closing

I had somewhat similar situation like this, it was because of the following line in /etc/pam.d/sshd ,
session required /lib/security/pam_limits.so

Whenever i try to log in as root, it gets connected, suddenly closes the session. After removing this line, problem solved
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to keep program running after closing ssh session fakie_flip Linux - Software 10 11-03-2011 08:33 AM
Crash when closing session energiza Linux - Hardware 1 06-15-2008 11:54 AM
SSH Slow Response/Session Closing FourierXForm Linux - Networking 3 08-07-2006 09:56 AM
About CD burning - closing session satimis Linux - General 4 07-13-2006 07:51 PM
closing SSH session without killing the SFTP transfer on the remote machine stevec Linux - Software 2 04-20-2006 05:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration