LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-19-2015, 09:57 PM   #1
iconus
LQ Newbie
 
Registered: Nov 2014
Posts: 6

Rep: Reputation: Disabled
set ssh to never time out on centos 6?


I need to set ssh to never time out, is this possible? I have active ssh connections at various times to my servers, and 1 in 5 times one of them time out. Can I prevent this on centos 6?
 
Old 05-20-2015, 03:21 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
Check out autossh

http://linuxaria.com/howto/permanent...s-with-autossh
 
Old 05-20-2015, 03:47 AM   #3
iconus
LQ Newbie
 
Registered: Nov 2014
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thank you for the link. I installed autossh. How do I configure to keep ssh alive? I'm looking around right now and can't really find a clear answer. I did find:


Code:
autossh -M 2002 -NL 16001:127.0.0.1:161 -f username@host.example.com
but it's not really explained. I don't need anything fancy only if the ssh stops or fails for some reason restart it with autossh.
 
Old 05-20-2015, 04:08 AM   #4
iconus
LQ Newbie
 
Registered: Nov 2014
Posts: 6

Original Poster
Rep: Reputation: Disabled
I don't need to tunnel I only want to keep my server alive so could I use something like this:

Code:
autossh -M 2002 -NL 192.168.10.1:161 -f root@192.168.10.1
Would this restart ssh if it fails?
 
Old 05-20-2015, 05:20 AM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
Try:

autossh -M 0 user@myserver
 
Old 05-21-2015, 02:46 AM   #6
iconus
LQ Newbie
 
Registered: Nov 2014
Posts: 6

Original Poster
Rep: Reputation: Disabled
Don't I need to provide at least the ssh port? I'm using 88 for ssh port.

Last edited by iconus; 05-21-2015 at 02:52 AM.
 
Old 05-21-2015, 04:51 AM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
In that case try:

autossh -M 2002 user@myserver -p 88
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to set up a static ip so I can ssh in using putty on fresh centos 6.3 install Xitherius Linux - Networking 3 01-28-2013 04:53 PM
LXer: How To Set Up Kippo SSH Honeypot On CentOS 5.5 LXer Syndicated Linux News 0 04-01-2011 06:40 PM
LXer: How To Set Up Kojoney SSH Honeypot On CentOS 5.5 LXer Syndicated Linux News 0 10-04-2010 10:00 AM
Time skew of 580 min when I set my time zone in Gentoo scooter2 Linux - Newbie 1 03-05-2009 10:27 AM
Where does RH8 daily set system time to hardware clock time smartnorman Red Hat 1 05-24-2006 02:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:26 AM.

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