fir3net
PPS-Firenetbanner-780.5x190-30-03-17

Bash / Korn - Change the default session timeout

This short guide will show you how to set the default session timeout. We will set the TMOUT variable, of which is supported by both shells, Bash and Korn.

To check your current timeout setting, enter the following,

[root@localhost ~]# env | grep TMOUT

To change this setting globally edit the /etc/bashrc. To change this setting per user edit ~/.bashrc.
Below are the required settings you will need to add/modify to your bashrc file.

echo "TMOUT=300 >> /etc/bashrc
echo "readonly TMOUT" >> /etc/bashrc
echo "export TMOUT" >> /etc/bashrc

This will set your timeout to 5 minutes and also prevent anyone from modifying these settings.

About the Author

RDonato

R Donato

Rick Donato is the Founder and Chief Editor of Fir3net.com. He currently works as a Principal Network Security Engineer and has a keen interest in automation and the cloud.

You can find Rick on Twitter @f3lix001