Monday, 25 July 2022

The ssh "timed out waiting for input: auto-logout

 https://www.linvirtshell.com/2017/11/changing-auto-logout-timeout-in-ssh.html

https://unix.stackexchange.com/questions/222283/read-only-tmout-variable-workaround-to-disable-automatically-exit-shell-when-t

!!! Sometimes it might not be in /etc/profile

use 

sudo find /etc/ -name "*" | xargs sudo grep "TMOUT" 2>&1 | grep -v "filter..."

to find where it is like , the following example it is in /etc/bash.bashrc

/etc/bash.bashrc:TMOUT=900

/etc/bash.bashrc:readonly TMOUT

/etc/bash.bashrc:export TMOUT

//
TMOUT=900
readonly TMOUT
export TMOUT


then in profile.d
/etc/profile.d/autologout.sh:TMOUT=900
/etc/profile.d/autologout.sh:readonly TMOUT
/etc/profile.d/autologout.sh:export TMOUT

// Please also check /etc/profile

// Default should be

// readonly TMOUT=900; export TMOUT

// READ ONLY will prevent TMOUT to be overwritten by ~/bash_profile

// SO comment out 

// #readonly TMOUT=900; export TMOUT

// CHANGES TO /etc/prorfile needs a relog as well

// change to 

// TMOUT=900; export TMOUT

// TO SHOW time out value do the following


[root@localhost ~]# timed out waiting for input: auto-logout

[root@localhost ~]# echo $TMOUT
900


// You can overwrite this in your /.bash_profile for your user

// TMOUT= #turn off auto-logout (user session will not auto-logout due to session inactivity)

Often this value is defined in /etc/profile (globally) or your user's profile (~/.profile or ~/.bash_profile).


To alter the auto-logout amount, set the TMOUT environment variable accordingly:


* TMOUT=120   #set an auto-logout timeout for  2 minutes

* TMOUT=1200  #set an auto-logout timeout for 20 minutes


* TMOUT=   #turn off auto-logout (user session will not auto-logout due to session inactivity)


This value can be set globally (e.g. TMOUT=1200) in the /etc/profile file; however, each user can override the value by setting the TMOUT variable in their personal profile file (~/.profile or ~/.bash_profile). To do this simply set the TMOUT variable as you like in your profile file.


Dont forget to source the file you changed to get the settings to take effect immediately or log out and log back in.


I hope the article was useful.

No comments:

Post a Comment