Is there a program that displays the login message formatted like this:
Last login: Wed Oct 24 16:40:33 2012
Or do I have to write my own program/script? I was wondering if there is a command the Linux kernel (or whoever) runs to do that.
|
The kernel does not track login information. You can configure PAM (
Or a bit more verbose:
Or one that also prints failed logins:
On Fedora, it might go to The information is stored in |
|||||||||||||
|
|
I wrote some code to do it for me:
It doesn't work for non-remote logins, but I am running the code on a headless server, so 99.9% of the logins will be remote logins; the other 0.1% will be when I "attach a head" to fix |
|||
|
|
# man last(shows details of last logged in users).# echo last -n 2 root >> /etc/profilewould show last 2 logged-in session for user 'root'. Is it that you was looking for? – Mayur Pipaliya Oct 27 '12 at 20:24