How to know login/logout time (between screen locks) of a Linux user.


I am a manager and would like to know my worker's log-in, log-out time *** BETWEEN HIS SCREEN LOCKS ***.  
This question was not for a first-time log-in session because IT workers (and users) were rarely log off their computer at the end of the day, instead they just used screen-lock.  

In sumary, I would like to know how much time my workers work (during daytime and after hours).  Remember they never log off completely (in Linux, Gnome or KDE environment).

Who is Participating?
Screen lock is on the client PC, and therefore there is no central access to information about it.

Only option if this *really* is the approach that you are going for is to change the filename xlock to xlock main, and create a new xlock file, make it executeable, and put in a script that for example:


before calling xlock .

You'd need to repeat this for xscreensaver etc.

Another idea is that you could try adding 'nagios' to 'monitor' client PCs:

and then see when the CPU usage drops....then again, some of these screen savers use a huge amount of processing power. Obviously with either of these ideas, you have all the social, privacy and associated legal complications that may arise.

Hmmm, I have this session running for about two weeks now.

The first question I would ask is why you are doing this (there is a possible technical solution, but sometimes social solutions are just better).  If people are getting work done, then you shouldn't have major objections to their moving away from the screen at times.
Run "set autologout" or otherwise enable automatic logout on time expiry for console users.

Then simply use the "last" command and diff them.
kblack05 - these are X users, not console.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.