Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Sep 2002 16:14:18 -0600
From:      Lyndon Nerenberg <lyndon@orthanc.ab.ca>
To:        freebsd-hackers@freebsd.org
Subject:   Enhanced lastlogin(8)
Message-ID:  <200209152214.g8FMEIsl078355@orthanc.ab.ca>

index | next in thread | raw e-mail

I've re-implemented lastlogin, adding a parsable output format that
makes it easy to scan for stale accounts. The differences are
described below. Since others might find this useful, I've put the
code up at ftp://orthanc.ab.ca/lyndon/freebsd/usr.sbin/lastlogin/.
(If anyone wants to commit this, feel free.)

-----

This is a re-implementation of lastlogin. It differs from the
version included with FreeBSD 4.6 in the following ways.

(Note: FL == "FreeBSD 4.6 lastlogin")

* FL directly accessed /etc/passwd. It couldn't deal with NIS accounts.
This version uses the getpw*() API to access the password database.

* This version doesn't use stdio to access the lastlog file.

* This version doesn't sort the results by uid. If you actually rely
on that behaviour I would like to hear from you.

* New -a flag makes lastlogin print information for users who have
never logged in.

* New -n flag prints (only) the last login time, in seconds since
the epoch. For example:

root	1031358466
lyndon	1032115401

The two fields are tab seperated. This format is designed to be
easily parsed by other programs.

* FL always displayed the contents of pw_name for the user name.
If the password database contained multiple records with the same
uid and unique names, the output from FL might not match the input.
Let's say your password database contains these records:

lyndon:*:100:100:::
bob:*:200:200:::
fred:*:100:100:::

the output from "lastlogin bob fred" might display:

lyndon            ttyp3    :0.0               Sun Sep 15 15:15:17 2002
bob               ttyp0    example.com        Mon Dec 11 01:30:03 2000

In this version, the name from the command line is printed instead
of the contents of pw_name.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209152214.g8FMEIsl078355>