From owner-freebsd-hackers Sat Feb 28 15:21:21 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id PAA02613 for freebsd-hackers-outgoing; Sat, 28 Feb 1998 15:21:21 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from smtp04.primenet.com (smtp04.primenet.com [206.165.6.134]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id PAA02607 for ; Sat, 28 Feb 1998 15:21:15 -0800 (PST) (envelope-from tlambert@usr08.primenet.com) Received: (from daemon@localhost) by smtp04.primenet.com (8.8.8/8.8.8) id QAA16295; Sat, 28 Feb 1998 16:21:12 -0700 (MST) Received: from usr08.primenet.com(206.165.6.208) via SMTP by smtp04.primenet.com, id smtpd016287; Sat Feb 28 16:21:09 1998 Received: (from tlambert@localhost) by usr08.primenet.com (8.8.5/8.8.5) id QAA09889; Sat, 28 Feb 1998 16:21:08 -0700 (MST) From: Terry Lambert Message-Id: <199802282321.QAA09889@usr08.primenet.com> Subject: Re: lastlog data not change during adduser To: 1193016@student.unpar.ac.id (Thomas Wahyudi) Date: Sat, 28 Feb 1998 23:21:08 +0000 (GMT) Cc: freebsd-hackers@FreeBSD.ORG In-Reply-To: from "Thomas Wahyudi" at Feb 28, 98 07:58:17 pm X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > Hi, I wonder, why when I remove user A uid X and add user B, > user B uid become X. Then I finger user B, hmm the lastlog show that > last login user B is same with user A. Accounting in /var/log/lastlog is done by uid. > Should, lastlog initialize data if user A is removed ? You should probably monotonically increase user ID's to avoid the reuse, if possible. This gets into "wrap regions", etc., for complicated user setups. The problem is that you really do *not* want to destroy the accounting information for the previous user. One possible fix is a generation count. Another possible fix is "user reset" lastlog entry. One way to implement this would be to write a 0 valued time_t for the user to lastlog when a user is deleted, and use this as a flag. You would have to inform all utilities about this, and include the possibility of displaying different generations of users (ie: if you saw three such records, then you would report the current user's accounting records as "fourth generation", and there would need to be some generation selector to things like last, which only applied when a specific user id was specified (ie: for UID 1075, a numberic id should be used, as in 1075:1 for the first instance of 1075's records). Ie: it's a lot easier to just use monotonically increasing UID's and expect that the lastlog will be rolled (aging the old ID out) before it ever becomes an issue. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message