Avatar of Dwight Baer
Dwight BaerFlag for Canada

asked on 

linux - how to configure the bash session timeout

Red Hat Linux version 8.3 - In a bash terminal session, it's annoying after every few minutes when I have to retype my password.  How to configure the timeout variable or whatever it's called?

(I'm in a gnome environment, in case that's significant.)

Thanks
LinuxRedhat* Shell

Avatar of undefined
Last Comment
arnold
Avatar of Dr. Klahn
Dr. Klahn

Local session at the computer, or remote?  If remote, via telnet or SSH?
Avatar of Dwight Baer
Dwight Baer
Flag of Canada image

ASKER

Actually, I'm running this instance of linux within a VMWare environment.  Might it be possible that the short timeout window has something to  do with VMWare ESXi?  I don't think so.
Avatar of Dwight Baer
Dwight Baer
Flag of Canada image

ASKER

It's a console session within the RHEL vm in Vmware
Avatar of arnold
arnold
Flag of United States of America image

Graphical or Terminal?


See https://access.redhat.com/discussions/2973871 for an example, check display related preferences/settings.
Avatar of Dwight Baer
Dwight Baer
Flag of Canada image

ASKER

terminal
Avatar of Dwight Baer
Dwight Baer
Flag of Canada image

ASKER

So since I'm in a terminal session, I assume the screensaver solution above is not my answer?
Avatar of rindi
rindi
Flag of Switzerland image

How do you enter the password? Does it follow the "sudo" command? if so add the following to your /etc/sudoers file:

Defaults        env_reset,timestamp_timeout=20

Open in new window


Change the timeout of "20" according to your needs. A reboot may be required for the new setting to get registered.
Avatar of Dwight Baer
Dwight Baer
Flag of Canada image

ASKER

It would surprise me if a variable for (I assume) all bash sessions would be set in the sudoers file ... but I'm trying it.
Avatar of Dwight Baer
Dwight Baer
Flag of Canada image

ASKER

I think it may be a vmware thing.  

I figured out that if I'm just in the console session, it times out.  But if I do ctrl+alt+F3 for example to go to tty3 - it doesn't time-out.  I may have solved this.  So I'm guessing this isn't a bash thing at all.
Avatar of omarfarid
omarfarid
Flag of United Arab Emirates image

Try to see if env variable TMOUT is set for you:

echo $TMOUT

This variable defines the ideal timeout for session.

You can change this by running

export TMOUT=N

Open in new window


N is time in seconds.

You may change it to 0 to disable timeout.
Avatar of Yujin Boby
Yujin Boby
Flag of India image

Try

export TIMEOUT=0

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Duncan Roe
Duncan Roe
Flag of Australia image

setterm --blank 0 will stop your VT from blanking out, if that is your problem
Avatar of noci
noci

For BASH it is called TMOUT and you can configure it in ~/.bashrc or in /etc/profile ...

       TMOUT  If set to a value greater than zero, TMOUT is treated as the default timeout for the read builtin.  The select command terminates if input does not arrive after TMOUT seconds  when  input
 is coming from a terminal.  In an interactive shell, the value is interpreted as the number of seconds to wait for a line of input after issuing the primary prompt.  Bash terminates after waiting for that number of seconds if a complete line of input does not arrive.

How are you connected to that RH server? Are you perhaps using PuTTY? In PuTTY settings you can enable keep alive settings so you don't get disconnected. Those settings are not configured as default.
Avatar of arnold
arnold
Flag of United States of America image

The asker is connected to the Console 9f a VMWARE virtualized RH VM.
Avatar of Dwight Baer
Dwight Baer
Flag of Canada image

ASKER

I'll close this  question tomorrow.  Thanks so much to everyone for their help.
Avatar of Dwight Baer
Dwight Baer
Flag of Canada image

ASKER

Folks ... I've searched .bashrc as well as /etc/profile - I can't find anything setting TMOUT or TIMEOUT

Which doesn't mean of course that those comments are invalid - but it's not in my environment.

Meanwhile, I did solve the problem by just going into a different tty.  It appears that my VMware console will timeout;  but the tty sessions do not.
Avatar of arnold
arnold
Flag of United States of America image

ls -l //etc bashrc profile login etc are system wide settings.

in the local user .bashrc .login .profile see whether it sources other files.
try echo %TMOUT

please clarify on the console, using the key to toggle to another "session"?

console login as regular user or as root?

If not mistaken, the option might be set in the console/listening event/handler.
Avatar of noci
noci

 echo $TMOUT    probably works better than echo %TMOUT   (at least on any UNIX/Linux)

If you ony checked /etc/profile you may have missed it see also advice like this:
https://www.golinuxhub.com/2017/09/how-to-auto-logouttimeout-normal-user/

Avatar of arnold
arnold
Flag of United States of America image

Yes, incorrect deference  of a variable
Linux
Linux

Linux is a UNIX-like open source operating system with hundreds of distinct distributions, including: Fedora, openSUSE, Ubuntu, Debian, Slackware, Gentoo, CentOS, and Arch Linux. Linux is generally associated with web and database servers, but has become popular in many niche industries and applications.

71K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo