sign out issues on linux production servers

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
LVL 7
gudii9Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AlanConsultantCommented:
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Scott SilvaNetwork AdministratorCommented:
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 EngineerCommented:
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.
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

gudii9Author 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 FavorLinux/LXD/WordPress/Hosting SavantCommented:
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.
gudii9Author 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
gudii9Author 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 EngineerCommented:
Please check the TMOUT environment variable:

echo $TMOUT

I guess you get 60 back.
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
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 EngineerCommented:
@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.
AlanConsultantCommented:
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 FavorLinux/LXD/WordPress/Hosting SavantCommented:
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 EngineerCommented:
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..
gudii9Author 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?
gudii9Author 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?
Robert LemMrCommented:
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 AdministratorCommented:
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...
gudii9Author 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
Robert LemMrCommented:
It keep watching until you stop it; meaning when you do ctrl-c, it will cancel the command.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.