[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: What, why, where, utmp?



In article <Pine.LNX.3.96.971203202743.180A-100000@dwarf.polaris.net>,
Dale Scheetz <dwarf@polaris.net> wrote:
>One of my "gaping holes of ignorance" has to do with utmp entries; what
>they are, why are they gone, where is the package that creates them?

An utmp entry is an entry in a fixed-size binary database located in
/var/run/utmp. It describes a "login session" currently active on the machine,
that can be started by getty, telnetd, rlogind, ftpd, xterm, sshd etc.

>I know that one of the latest "fixes" to dpkg-buildpackage deals with the
>lack of utmp entries, but don't understand why they were abandoned.

They weren't - the size of the entries in the above mentioned database
changed because of the move to libc6 (libc6 defines a different, more
complete `struct utmp' which is the fixed-size entry I was talking about).
Because of that, some old programs were unable to read the new format.

>I just discovered that the command "login" is supposed to log the user out
>and present a new login prompt.

Not really - that only works if you do "exec login" thereby replacing your
current shell with a fresh login process.

>This command works ok if you are logged in
>as root, but when you try to use it as a user, you get a utmp entry
>missing error, with some statement about login only running from the base
>shell.

Presumably your root shell reckognizes "login" as a special case and does
an "exec login" instead, and the normal user shell doesn't.

I wouldn't recommend doing this by the way - normally, you exit from
the shell, the parent (either init, or rlogind, or telnetd etc) notices
this and writes a logout entry in the `wtmp' file. Then a new session
gets started and a new login entry starts. By using login directly, the
logout+new login entry never gets written so someone using "last" will only
see the first session (which accounts for the time spent by both the first
and the 2nd session). To prevent your users from doing this, take the `s'
bit off login!

>So, if there is anyone out there who can explain the problem (and has the
>inclination) I would appreciate some education. A good reference would
>probably work as well.

Hmm, I'm not sure if there's a complete reference somewhere.. I found out
all this stuff by trial and error. Hmm perhaps it would make a nice LJ
article :)

Mike.
-- 
 Miquel van Smoorenburg |  Studying to be a technomage   <*>
    miquels@cistron.nl  | "May you live in interesting times"


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: