LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-15-2018, 12:33 PM   #1
sniper8752
Member
 
Registered: Oct 2012
Posts: 564

Rep: Reputation: Disabled
ssh sessions randomly timing out


I've noticed that my SSH sessions are timing out, not before 5 minutes of inactivity. I looked in my ssh config file, and didn't see a timeout set. I didn't have this issue before. Here are two of my iptables rules, which is I believe, to be the culprit somehow:
Code:
-A INPUT -i eth0 -p tcp -m tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT
-A OUTPUT -o eth0 -p tcp -m tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT
I believe that I am missing an additional rule, as possibly packets are being dropped, closing out my session. Oddly enough, nothing shows up in my auth.log file when the session is terminated.
 
Old 05-15-2018, 02:42 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
There are many things that can enforce a timeout.

Within BASH itself the TMOUT variable can be set e.g. in /etc/bashrc or $HOME/bash_profile or some other environmental file.

A firewall device (e.g. Cisco ASA or Sonicwall) could set a timeout.

Here we actually do both of those but there are other things that might do it. (e.g. A cron job.)
 
Old 05-15-2018, 02:59 PM   #3
sniper8752
Member
 
Registered: Oct 2012
Posts: 564

Original Poster
Rep: Reputation: Disabled
My hardware has not changed.
I could not locate either of those files. I am running Ubuntu Server 16.
 
Old 05-16-2018, 11:37 AM   #4
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Rep: Reputation: 103Reputation: 103
Show the entire iptables rules. iptables -vnL INPUT and OUTPUT.
How does the session terminate? Does it say broken pipe? Does it happen suddenly, is there a timeout before you get an error?
 
Old 05-17-2018, 10:58 PM   #5
sniper8752
Member
 
Registered: Oct 2012
Posts: 564

Original Poster
Rep: Reputation: Disabled
Those would be the only two rules related to ssh. Does a forwarding rule need to be put in place? Is there nothing wrong with these two rules?
The session just closes unexpectedly, with no error or timeout.
 
Old 05-18-2018, 02:25 AM   #6
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Rep: Reputation: 103Reputation: 103
Well, you're quite reluctant to share information for someone who actually needs help. On the other hand, you're asking if ssh access needs a forwarding rule, which leads me to believe that you don't understand iptables (and that's ok), but you're not actually showing us what is going on there (which isn't ok). Moreoever, you haven't actually shown us what sshd_config looks like, you're just saying there's no timeout directive. What would a 'timeout' directive look like in ssh exactly? Are you referring to the correct two directives? Also, it wouldn't hurt to know what distro you're using...
EDIT: Sorry, you've already said what OS you're using. Are you using it as an independent bare metal server, or as a virtual machine/container?

Last edited by vincix; 05-18-2018 at 03:14 AM.
 
  


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 timing out Blunda Linux - Networking 9 10-24-2012 02:54 PM
[SOLVED] SSH keeps timing out from just one computer acampbell Linux - Networking 6 01-07-2012 06:11 AM
ssh timing out SciSteve Linux - Newbie 4 05-18-2010 07:55 PM
is there a way to restrict ssh sessions to a specific ssh client? smbhat Linux - Networking 8 03-11-2009 07:36 AM
SSH timing out/not connecting NeccoWolf Linux - Networking 2 01-26-2003 02:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

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