[2305] in SIPB_Linux_Development
logging all logins
daemon@ATHENA.MIT.EDU (Grant Emery)
Sun Nov 15 16:59:16 1998
To: linux-dev@MIT.EDU
Date: Sun, 15 Nov 1998 16:58:49 EST
From: Grant Emery <gemery@MIT.EDU>
hi, i'd like to suggest that the following code be added to login such
that i'll actually log all logins to the machine, not just root logins
and failed attempts. it starts at line 377 of login.c in the version i
pulled out of sipb-athena a while ago, i don't know how current that is.
here's the code and some context...
---
if (pwd->pw_uid == 0)
if (hostname)
syslog(LOG_NOTICE, "ROOT LOGIN ON %s FROM %s",
tty, hostname);
else
syslog(LOG_NOTICE, "ROOT LOGIN ON %s", tty);
/* begin log-all-logins hack */
else
if(hostname)
syslog(LOG_NOTICE, "%s logged in on %s from %s",
username, tty, hostname);
else
syslog(LOG_NOTICE, "%s logged in on %s", username, tty);
/* end log-all-logins hack */
if (!quietlog) {
struct stat st;
motd();
sprintf(tbuf, "%s/%s", _PATH_MAILDIR, pwd->pw_name);
if (stat(tbuf, &st) == 0 && st.st_size != 0)
printf("You have %smail.\n",
(st.st_mtime > st.st_atime) ? "new " : "");
}
---
-grant