Hi,
I am pretty much new to linux programming. I want to create a log file with some info when a user just logs in. so where can I find an event or something when a user logs in? is there any structure that has some flag when user logs in?
Thanks
Hi,
I am pretty much new to linux programming. I want to create a log file with some info when a user just logs in. so where can I find an event or something when a user logs in? is there any structure that has some flag when user logs in?
Thanks
The utmp
and wtmp
files contain last login data. See the man page for more information.
Read the manual page for utmp(5) and getutent(3)
The files:
/var/run/utmp
/var/log/wtmp
contain information about who's currently using the system. The wtmp file records all logins and logouts and the utmp file contains information of what kind of login it is, who logged in etc.