TMOUT - how to get around session idle time out set by admin ..?

Hi - Do anyone of you have practical way of getting around the TMOUT session idle time out set by the admin. Iam just a normal user of the unix server without any admin or SU previleges ... Iam aware of SLEEP or READ commands, etc that can help in session NOT getting closed ... but point is, i keep forgetting to enter the SLEEP or READ commands ... iam looking for some kind of snippet/command that needs to be RUN ONLY ONCE and then it should take care of not getting idle time out from the session ...

my current TIME OUT is set to 15mins which is very frustrating. I normally keep 4-5 putty window sessions open ...

EDIT --> TMOUT is a READ-ONLY variable and cannot be modified by users like me ... Iam connecting to my DEV SERVER via putty SSH ... i open and keep multiple putty window sessions to the same DEV server as i need to work on multiple interrelated project sandboxes

Thanks in advance and for your time !

Well we don't know your architecture or OS so it is difficult to answer...
When you say putty, I understand, that in fact your are on a PC, connecting via Putty on a/many? unix/linux host(s)...
which means that you connect ( I hope...) via ssh, which if it is the case, the admins can effectively set a timeout, which cannot be changed... depending their mood, if they did so, I believe they had good reasons...
Now I don't remember the default value of ssh, if it is the default, there are chances you can change its value...

1 Like

@i4ismail
not a guarantee as the system admin can still circumvent it, but in putty:
image

2 Likes

There are at least two standard keywords in sshd_config, which determine whether you can or cannot "get around session idle timeout" - if you want, read more about ClientAliveInterval and ClientAliveCountMax in man 5 sshd_config.

As a "workaround" similar to the one from your query, when I don't interactively work in SSH terminal session, then I usually just set some command to run in the "background" for the time being, before I need to get back to prompt and issue next commands interactively (so it's actually running in the foreground, but keeps the connection beyond "soft timeout" by constantly/frequently spewing some text to stdout).

You may try e.g.
watch -n 10 'ls -la'
or (for Bash)
while :; do echo "Keepalive $((i++))"; sleep 10; done
or similar, and see if it works for you.

Or just ask for it to be changed with accompanying justification.

2 Likes

i tried this option ... this would NOT work for SERVER side restrictions

Thanks, looking for a more better automated solution ... iam aware of similar commands (used SLEEP and READ commands) ... they work but you need to ensure that you do NOT forget to enter them which is a pain point ... i already mentioned abt this in my Original Post

TMOUT is a shell variable.
And has nothing to do with keep-alive or sshd settings.

Description in this article

If TMOUT is set read-only in /etc/bash.bashrc or an include file in /etc/profile.d/ then there is no way to change it in the curent shell.
You must start a further shell without a TMOUT.
Try
env TMOUT="" /bin/bash
Test with
echo $TMOUT
If this still shows a value then try
env TMOUT="" /bin/bash --noprofile --norc
Once you have started a shell without TMOUT, the calling (login-)shell is busy and won't time out.

2 Likes

Add this in your .profile, .bashrc or whatever you are using:
export TMOUT=0
This assumed that TMOUT was not defined as readonly. If it was, it won't work

A "system" startup file like /etc/bash.bashrc or /etc/profile or a file in /etc/profile.d/ comes first. If it sets TMOUT read-only, a following setting of TMOUT in .bashrc or .profile would only give error "TMOUT: readonly variable".

1 Like