This is something I have asking myself for some time. Imagine the following:

  • I press CTRL+ALT+F1 to switch to TTY1
  • I login there and execute a command
  • I switch back to xorg with CTRL+ALT+F7
  • I forget that I am still logged in in TTY1

Is this a security issue? I guess so as in my test the normal KDE-Lockscreen (Super+L) doesn't log me out of the TTY.

So is there a solution to automatically log out after X seconds (of inactivity)? Or to maybe logout of all TTY whenever I lock my window manager (KDE in my case)?


There is no integration with DE's lock screen and tty logins.

However, you can restrict bash sessions by setting the TMOUT variable. Edit your /etc/profile and set the following content on it:

export TMOUT=600 
typeset -r TMOUT

Or, to keep things organized, create the file /etc/profile.d/timeout.sh with the same content above, and set the executable bit on it ( chmod +x /etc/profile.d/timeout.sh ).

This will make all bash sessions older than 600 seconds of inactivity to timeout, and typeset -r will set this variable read-only so, users can't change it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.