Is it possible to see the login history, i mean to see if someone has used the computer in my absence and when he used it .
if it is possible, where can i get the log ?
if not, is there a program that logs all the logins and their time ?
5 Answers
/var/log/auth.logThat contains a lot more than just plain logins (sudo calls, etc) but logins are in there too. It's protected so you'll need to be root to read it:
sudo less /var/log/auth.log 3 As Suhail mentioned in a comment, the last command will show a listing of last logged in users.
To view the most recent login for all accounts on the system, try lastlog. There's a few useful options, such as viewing only a specific user.
Well appending your question and oli's answer if you are on laptop then you can also check it through grepping the exact content like
sudo cat /var/log/auth.log | grep "Lid opened"or
sudo cat /var/log/auth.log | grep "Lid closed"and whether he/she perform any kind of activity through sudo permission by
sudo cat /var/log/auth.log | grep "session opened for user root"or
sudo cat /var/log/auth.log | grep "session closed for user root"It will give you extra information what you want to know about user's logged in your system without your permission :):)
3To see the last boot or login of your system and users, you can use the command who with plenty of options.
who -a