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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
01-19-2009, 09:50 PM
|
#1
|
Member
Registered: Aug 2006
Posts: 168
Rep:
|
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
|
|
|
01-19-2009, 10:07 PM
|
#2
|
Senior Member
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Rep: 
|
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).
|
|
|
01-19-2009, 11:31 PM
|
#3
|
Member
Registered: Aug 2006
Posts: 168
Original Poster
Rep:
|
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
|
|
|
01-20-2009, 01:45 PM
|
#4
|
Senior Member
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Rep: 
|
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?
|
|
|
01-20-2009, 02:43 PM
|
#5
|
Senior Member
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098
Rep: 
|
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?
|
|
|
01-22-2009, 12:18 AM
|
#6
|
Member
Registered: Aug 2006
Posts: 168
Original Poster
Rep:
|
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.
|
06-16-2010, 02:35 PM
|
#7
|
LQ Newbie
Registered: Sep 2009
Posts: 8
Rep:
|
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.
|
|
|
01-12-2012, 01:12 AM
|
#8
|
LQ Newbie
Registered: Jan 2012
Posts: 1
Rep: 
|
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
|
|
|
All times are GMT -5. The time now is 07:46 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|