sign out issues on linux production servers

gudii9
gudii9 used Ask the Experts™
on
unix server keep sign out after 1 minute or so on production.

is there is a way i can run some process like

tail -f xyz.gz
to keep continuous rolling until i cancel that so that it wont sign out on me while i focus on some other work  for 30 miinutes and come back it should not signout
please advise
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Consultant
Commented:
Hi,

First option would to change the timeout so that you don't get logged out for 30 mins or whatever makes sense.

If you can't do that, you could try something like:

watch -l xyz.log


I have never tried what you are wanting to do, so I am not sure if that will work - it might be purely dependent on keyboard / mouse interaction, in which case it won't work, but no harm in trying.

You might also look at something like 'Caffeine' (if you are using Gnome, which may not be on your production server), but I think it is not maintained any more, so I'd be reluctant to have it on a production server (or even my own machine!)


Better to change the setting for that username to not sign out after one minute, but you may be constrained on that.


Alan.
Scott SilvaNetwork Administrator
Commented:
Or learn to use something like screen to run your sessions in so you can sign back in and get to the process you left running with no gaps...

https://www.howtoforge.com/linux_screen
nociSoftware Engineer
Distinguished Expert 2018
Commented:
Most probably this is to discourage to work under that account on the server...

For command shells:
The TMOUT environment specifies how longa shell can be idle before it disconnects. The time is specified in seconds.

So i guess there is TMOUT=60 some where in a login script.
set it to TMOUT=1800 for half an hour.

More important  Why was this set... there must be a reason for it. It's no default, and no accident.
Being logged on might prevent some application from accessing the console for putting messages there f.e.

And running X sessions on a production serveris not the first thingthat comes to mind... Check the screensaver settings
for that one.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
i cannot change anything on prod servers
i tried
tail -f xyz.gz

problem i faced after some time that file consolidated and new file getting created and my tail is failing and server is signing out again
does watch do that continuously?
David FavorFractional CTO
Distinguished Expert 2018
Commented:
Start by describing how you've logged into your production server.

1) ssh

2) sftp

3) curlftpfs to mount a file system

4) CMS like WordPress

Sounds like probably ssh + best to know starting point clearly, as first step.

Author

Commented:
$ watch -l xyz.log.20181011
watch: invalid option -- 'l'
Usage: watch [-dhntv] [--differences[=cumulative]] [--help] [--interval=<n>] [--no-title] [--version] <command>
i get above error
please advise

Author

Commented:
start by describing how you've logged into your production server.


i have putty
i go to the particuler server say
server6

it asks username i give like john
it asks interactive password i give my 8 digit passcode i set earlier along with rsa token code which keeps on changing every few secons
nociSoftware Engineer
Distinguished Expert 2018

Commented:
Please check the TMOUT environment variable:

echo $TMOUT

I guess you get 60 back.
David FavorFractional CTO
Distinguished Expert 2018

Commented:
The normal way to disable connection timeouts with ssh is to pass -o TCPKeepAlive=yes which means all connections are persistent... never timeout...

http://www.nth-design.com/2010/05/10/using-keepalive-in-putty/ shows how to enable this in Putty.
nociSoftware Engineer
Distinguished Expert 2018

Commented:
@David, TCPKeepAlive is for keeping traffic so NAT tables / statefull inspection data in a firewall don't get dropped. And that mostly peters out with 20 something minutes.
AlanConsultant

Commented:
Hi,

In terms of using 'watch', I missed typing 'ls' in there.  It should be:

watch ls -l xyz.log

Open in new window

However, no idea if that will work or not (in terms of keeping the session alive).

As mentioned above, 'screen' is possibly a good option.

Alan.
David FavorFractional CTO
Distinguished Expert 2018

Commented:
I suggest you give the KeepAlive trick a try + see if that fixes your problem.

If this fails, try https://bjornjohansen.no/ssh-timeout which discusses sshd settings which effect session life.

Keep in mind. If you change sshd settings, you must restart sshd + then start new sessions for new settings be take effect.
Mihai BarbosTrying to tame bits. They're nasty.
Commented:
As Scott has said, screen might be your friend here...
nociSoftware Engineer
Distinguished Expert 2018

Commented:
Did you check the TMOUT variable. If set that is the max idle time for a shel before it logs you off.
if TMOUT has been set you can just change it by setting to the right number of seconds:
TMOUT=1800   # 30 minutes
TMOUT=3600   # one hour\
TMOUT=86400 # one day

before the idle timer drops the shell.
In your case it probably is 60..
echo $TMOUT #will tell.

Please confirm it's setting ro tell here TMOUT is not set..

Author

Commented:
$ echo $TMOUT

above did not return any value
i do not have any control on these boxes except i can read those logs
any alternate trick to keep session alive all the time?

Author

Commented:
$ watch -l xyz.log.20181011
watch: invalid option -- 'l'
Usage: watch [-dhntv] [--differences[=cumulative]] [--help] [--interval=<n>] [--no-title] [--version] <command>
i get above error
please advise
what is wrong with above command?
Commented:
Missing the command to watch "ls". The -l option applies to the ls command not the watch command.

Type: watch ls -l xyz.log.20181011
Scott SilvaNetwork Administrator

Commented:
If you are not allowed to extend the timeout I think screen might be your only option. But if you also don't have screen or aren't allowed to install it, your options will be extremely limited...

It is a bit uncommon for someone that is allowed log access to not have some influence on needed tools to do that job...

Author

Commented:
Missing the command to watch "ls". The -l option applies to the ls command not the watch command.

Type: watch ls -l xyz.log.20181011

above command worked.

how long it keep watching

Commented:
It keep watching until you stop it; meaning when you do ctrl-c, it will cancel the command.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial