is there a way to lock a login console of a server after a certain time of inactivity? just lock; not log the user out.
if found vlock
(and physlock
) that seems to do a decent job of locking the login session. but is there a way to invoke it after a given time of user inactivity? i only can invoke it right now and its timeout flag does not seem to do what i need.
this seems to be a way on how to do it in zsh
; but i'd need something in bash
.
also note: i am not concerned about ssh
sessions. and this is about servers (without any X
installed).
UPDATE i know about TMOUT
. i do not want to log the user out, i just want to lock their screen.
(also posted the question over at serverfault.com)
You can append the following line to
~/.bashrc
or/etc/bash.bashrc
(to apply it for all user):Then
source ~/.bashrc
or open new login shell and after 120 seconds of inactivity it will be closed. Note the login shell could be a hardware TTY/console or ssh connection, or some GIU terminal emulator as gnome-terminal, etc.Source: