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

Posted on 2006-05-20
Last Modified: 2007-12-19

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).

Question by:johnminhpham
    LVL 3

    Expert Comment

    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.
    LVL 11

    Expert Comment

    Run "set autologout" or otherwise enable automatic logout on time expiry for console users.

    Then simply use the "last" command and diff them.
    LVL 3

    Expert Comment

    kblack05 - these are X users, not console.
    LVL 22

    Accepted Solution

    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.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Suggested Solutions

    Title # Comments Views Activity
    Solaris folders to exclude from AV scan 11 82
    Fail2Ban restart 5 61
    linux, squid, exchange 14 110
    Encrypted Laptop running Linux 3 60
    Hello EE, Today we will learn how to send all your network traffic through Tor which is useful to get around censorship and being tracked all together to a certain degree. This article assumes you will be using Linux, have a minimal knowledge of …
    BIND is the most widely used Name Server. A Name Server is the one that translates a site name to it's IP address. There is a new bug in BIND (, affecting all versions of BIND 9 from BIND 9.1.0 (inclusive) thro…
    This video discusses moving either the default database or any database to a new volume.
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now