LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-12-2011, 07:38 AM   #1
felix001
Member
 
Registered: Jan 2009
Posts: 101

Rep: Reputation: 15
SSH Disconnects


Im currently connecting to 2 Linux servers over my remote access VPN via SSH.
Once server is fine, the other keeps disconnecting at random times sometimes after a few seconds idle, sometimes after a few minutes.
Ive run a debug on the SSH daemon and can see it say,

"Read error from host x.x.x.x: Connection reset by peer"

Ive checked the networking on the problematic box but everything appears fine speed/duplex/interface errors.

Does anyone have any ideas ??
 
Old 12-12-2011, 03:55 PM   #2
soonblue
LQ Newbie
 
Registered: Oct 2007
Posts: 8

Rep: Reputation: 0
more info

Are you connecting to these two servers from a Linux box or a Windows box using putty or something similar? I have seen weird behavior before with some servers when not sending KEEPALIVE packets every thirty seconds or so. You can edit the ServerAliveInterval on Linux to accomplish the same thing. Alternatively, take a look at your sshd_config file on the servers and lower ClientAliveInterval. This will send a packet to your client during inactivity. It may take a little tweaking. Also, how are the firewalls on your servers and client configured?

Blue

University of Delaware
Network & Systems Services
Systems Programmer III
 
Old 12-13-2011, 11:46 AM   #3
felix001
Member
 
Registered: Jan 2009
Posts: 101

Original Poster
Rep: Reputation: 15
Hey,

Im logging in from a windows box. Typically using putty.
The firewalls between me and the server should be fine since I can connect to other linux servers on the same network without any issues/disconnects.

Its strange as Ive logged onto millions of Linux servers in the past but never has this issue(??).
Ive added a 1 sec Interval to the sshd config so will test this and let you know how it goes.

Is there anything odd in the config that you can see.

Code:
PasswordAuthentication no
#PermitEmptyPasswords no

# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes

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

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

# This is enabled, PAM authentication is allowed through the
# ChallengeResponseAuthentication and PasswordAuthentication.
#UsePAM no
UsePAM yes

AllowTcpForwarding no
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveCountMax 3
ClientAliveInterval 1
ClientAliveCountMax 10
UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10
#PermitTunnel no


# override default of no subsystems
Subsystem       sftp    /usr/libexec/openssh/sftp-server
 
Old 12-15-2011, 04:16 AM   #4
linuxrndblog
Member
 
Registered: Oct 2010
Location: India
Posts: 89

Rep: Reputation: 2
Dear felix001,

I have understood your problem. Just put the below option in sshd_config file under /etc/ssh/ directory.

ClientAliveInterval 180

[root@localhost ~]# cd /etc/ssh/
[root@localhost ssh]# pwd
/etc/ssh
[root@localhost ssh]# ll
total 200
-rw------- 1 root root 132839 Mar 31 2010 moduli
-rw-r--r-- 1 root root 1827 Mar 31 2010 ssh_config
-rw------- 1 root root 3324 Nov 18 18:30 sshd_config
-rw------- 1 root root 668 Nov 17 00:49 ssh_host_dsa_key
-rw-r--r-- 1 root root 590 Nov 17 00:49 ssh_host_dsa_key.pub
-rw------- 1 root root 963 Nov 17 00:49 ssh_host_key
-rw-r--r-- 1 root root 627 Nov 17 00:49 ssh_host_key.pub
-rw------- 1 root root 1675 Nov 17 00:49 ssh_host_rsa_key
-rw-r--r-- 1 root root 382 Nov 17 00:49 ssh_host_rsa_key.pub
[root@localhost ssh]#
 
Old 12-15-2011, 08:16 AM   #5
felix001
Member
 
Registered: Jan 2009
Posts: 101

Original Poster
Rep: Reputation: 15
I tried this setting but the connection still times out (
 
Old 12-16-2011, 10:57 PM   #6
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: RHEL 7.x, SLES 11 SP2/3/4
Posts: 1,195
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
try this

Code:
#vi /etc/ssh/ssh_config
ServerAliveInterval 60---->(add this line)
Code:
#cd ~/.ssh/config ------>create this file if doesnot exist
Host *
 ServerAliveInterval 60
NOTE: start the second line in this file after a space

or add your server's hostname
Code:
Host server.example.com
 ServerAliveInterval 60
restart the ssh server
 
Old 12-17-2011, 07:47 AM   #7
novice06
Member
 
Registered: Mar 2006
Location: Singapore
Distribution: RHEL, CentOS
Posts: 132

Rep: Reputation: 23
This is very common problem and very difficult to trace. It could be because of internet link, firewall, vpn.
Workaround:
If you are only shell access to server, one easy way to overcome this is use "screen" utility. connection broken when you are doing something, after reconnect just reattach
 
Old 12-19-2011, 07:25 AM   #8
linuxrndblog
Member
 
Registered: Oct 2010
Location: India
Posts: 89

Rep: Reputation: 2
Dear felix001,

Are you resolve this issue? or still facing same issue?
 
Old 12-20-2011, 07:16 AM   #9
felix001
Member
 
Registered: Jan 2009
Posts: 101

Original Poster
Rep: Reputation: 15
Im still having the same issue (
 
Old 12-20-2011, 07:17 AM   #10
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: RHEL 7.x, SLES 11 SP2/3/4
Posts: 1,195
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
Quote:
Originally Posted by felix001 View Post
Im still having the same issue (
did you tried what I said?
 
Old 12-20-2011, 07:59 AM   #11
felix001
Member
 
Registered: Jan 2009
Posts: 101

Original Poster
Rep: Reputation: 15
Yes Im afraid I did, but still no luck.
 
Old 12-23-2011, 10:27 AM   #12
felix001
Member
 
Registered: Jan 2009
Posts: 101

Original Poster
Rep: Reputation: 15
I ran a packet capture and can see a RST being sent from the server ??
Any other ideas anyone.
 
  


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
ssh disconnects Xris718 Linux - Software 5 07-22-2010 04:30 PM
SSH disconnects dirtybird04 Linux - Networking 2 11-04-2009 05:36 AM
ssh disconnects goldwing Linux - Networking 3 05-26-2008 09:42 AM
From Win. to FC 5 : SSH disconnects mufy Linux - Networking 1 12-01-2006 02:07 AM
Mac OS X ssh client / linux sshd : ssh hangs/disconnects Apollo77 Linux - Networking 1 05-24-2006 11:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:53 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