Scenario is like this: OS : centos

I logged in to my machine and then lock using Ctrl+Alt+L. For unlock I need to enter my password which unlock my machine. So I need to track time at which my PC unlocks with out root permission.


  • 1
    define who please, if it is just a user session unlock for sure the user is always the same one. How could be possible to detect who is the person that unlocked the session? try to type last command and check if this is something that can help you – lese Nov 25 '15 at 9:54
  • @lese who and last comment provide information based on whether new terminal is opened or not. But what If I work on already opened terminal after unlock ? – EmptyData Nov 25 '15 at 10:10
  • mmm, I guess you could make a script to shot a picture with your webcam everytime your session is unlocked. Just joking, please, define who : ) – lese Nov 25 '15 at 10:13
  • If I am unlocking with a username xyz here I am assuming that xyz has unlocked this machine , I just want to know time at which user unlocks the machine. – EmptyData Nov 25 '15 at 10:18
  • 1
    I found answer at superuser.com/a/668628 – EmptyData Nov 25 '15 at 10:24

When you lock with Ctrl+Alt+L, most likely you simply enable a screen saver application which also asks for a password. I think there is no automatic way, unless you tweak the screen saver application to track it.

For example you can create a wrapper script which will log the time and start the screen saver, and log time when it is finished, though it is not trivial.

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.