GNOME Bugzilla – Bug 93906
Figure out utmp, wtmp, lastlog, --login etc.
Last modified: 2004-12-22 21:47:04 UTC
This is a catch-all bug for sorting out utmp/wtmp/lastlog/--login on a high level, will dup all the outstanding issues here to clean up bugzilla a bit. Here are the steps in my mind: - figure out exactly what each of these are used for and when they covary or need to be independent - figure out what the correct defaults are - figure out use-cases for using nondefault settings - figure out appropriate UI for those use-cases including command line options and prefs options (The answer seems to be "w" and "talk" for the most part.)
*** Bug 82904 has been marked as a duplicate of this bug. ***
*** Bug 82905 has been marked as a duplicate of this bug. ***
*** Bug 82906 has been marked as a duplicate of this bug. ***
*** Bug 92284 has been marked as a duplicate of this bug. ***
*** Bug 93770 has been marked as a duplicate of this bug. ***
*** Bug 82909 has been marked as a duplicate of this bug. ***
*** Bug 82908 has been marked as a duplicate of this bug. ***
Nalin kindly wrote this up, see vte/doc/utmpwtmp.txt, I'll paste its current version for convenience. The utmp, wtmp, and lastlog files are used to track which users are logged in, but in slightly different ways. Summary: The utmp file contains at most one entry per terminal. The wtmp file has the same format as the utmp file, but has no limit on the number of entries it contains. The lastlog file contains at most one entry per UID. When a user logs in, the entry for the terminal is set in utmp. When a user logs in, an entry is appended to wtmp. When a user logs in, the entry for the user's UID is set in lastlog. When a user logs out, the entry for the terminal is cleared from utmp. This prevents the utmp file from growing beyond a fixed size. When a user logs out, an entry is appended to wtmp. This provides a complete history of who logged in and out and when. When a user logs out, nothing happens to the lastlog. Conclusions: A terminal should always log to utmp, because it keeps track of who's using a given terminal device. A terminal should probably log to wtmp, because it correlates with utmp. A terminal should not log to lastlog, but a display manager should. References: http://netbsd.gw.com/cgi-bin/man-cgi?utmp++NetBSD-current http://www.netsys.com/sunmgr/1997-12/msg00155.html
My interpretation of this is: - lastlog should correspond exactly to the login shell option, i.e. if this is a login shell we do lastlog, otherwise we assume the user is already logged in and gdm did lastlog. So there's no separate lastlog setting, it keys off whether you are creating a login session. - utmp/wtmp should be the same setting, because wtmp is the history of changes to utmp. So there are two flags, login/nologin and track-the-terminal/dont-track-the-terminal. The defaults should be nologin and track-the-terminal. nologin because gdm already does the login, and track-the-terminal so that write, ytalk, etc. work. I guess that's exactly what Nalin said, just writing it down to be sure I have it straight.
*** Bug 99898 has been marked as a duplicate of this bug. ***
*** Bug 119910 has been marked as a duplicate of this bug. ***
Note 119910 has a patch to make terminal-widget pass the update-record option to vte.
Here follows a patch that implements what I understand from Nalin's description---which is not the same as what Havoc understood :( -- update lastlog only if the shell is to be a login shell; this should not be the default; -- always update the utmp record; and -- only update the wtmp record if the profile says so, and let profiles say so by default.
Created attachment 24235 [details] [review] Do all that
This needs to wait for 2.7
Created attachment 29056 [details] [review] Do it all, correctly now Ok. More reading convinced me that utmp and wtmp should either both be updated simultaneously or both let alone. This is what I commited on HEAD: it updates lastlog for login shells, and utmp/wtmp for when the profile says so. It also removes "utmp/wtmp" from the UI.
Comment on attachment 29056 [details] [review] Do it all, correctly now Fixed on HEAD.