Goal: Log login failures to the btmp file Notes: * I'm not sure login should add an entry in the FTMP file when PAM is used. (but nothing in /etc/login.defs indicates that the failure is not logged) Index: shadow-4.4/src/login.c =================================================================== --- shadow-4.4.orig/src/login.c +++ shadow-4.4/src/login.c @@ -834,6 +834,24 @@ int main (int argc, char **argv) (void) puts (""); (void) puts (_("Login incorrect")); + if (getdef_str("FTMP_FILE") != NULL) { +#ifdef USE_UTMPX + struct utmpx *failent = + prepare_utmpx (failent_user, + tty, + /* FIXME: or fromhost? */hostname, + utent); +#else /* !USE_UTMPX */ + struct utmp *failent = + prepare_utmp (failent_user, + tty, + hostname, + utent); +#endif /* !USE_UTMPX */ + failtmp (failent_user, failent); + free (failent); + } + if (failcount >= retries) { SYSLOG ((LOG_NOTICE, "TOO MANY LOGIN TRIES (%u)%s FOR '%s'", Index: shadow-4.4/lib/getdef.c =================================================================== --- shadow-4.4.orig/lib/getdef.c +++ shadow-4.4/lib/getdef.c @@ -57,7 +57,6 @@ struct itemdef { {"ENVIRON_FILE", NULL}, \ {"ENV_TZ", NULL}, \ {"FAILLOG_ENAB", NULL}, \ - {"FTMP_FILE", NULL}, \ {"ISSUE_FILE", NULL}, \ {"LASTLOG_ENAB", NULL}, \ {"LOGIN_STRING", NULL}, \ @@ -88,6 +87,7 @@ static struct itemdef def_table[] = { {"ERASECHAR", NULL}, {"FAIL_DELAY", NULL}, {"FAKE_SHELL", NULL}, + {"FTMP_FILE", NULL}, {"GID_MAX", NULL}, {"GID_MIN", NULL}, {"HUSHLOGIN_FILE", NULL},