utmp[x]/wtmp[x] logging?

David Lee T.D.Lee at durham.ac.uk
Tue Sep 28 10:40:36 GMT 1999

On Sat, 4 Sep 1999, David Lee wrote:

> At our site of potentially 14,000 samba users(*), our management folks
> are, quite reasonably(!), wanting to collect samba usage figures.  How? 
> Samba currently does connection logging into the "STATUS..LCK" file via
> "claim_connection()" etc.  This can be examined by the smbstatus command.
> Has any thought being given to supplementing this with utmpx/wtmpx -style
> logging on UNIX?
> At large sites with an already well-established utmpx/wtmpx accounting
> scheme on UNIX, it can be highly desirable to include (either rolled-in or
> parallel) similar samba connection information.  Rather than hacking
> together post-processing tools for "smbstatus" (which would fail to
> include cumulative information), it seems preferable to allow samba to
> generate utmpx/wtmpx records. 
> It would also allow standard UNIX utilities such as "who" and "last" to
> work on samba connections.
> I hope the idea is moderately sensible?  If not, why not, please?  I would
> be happy to have a go at further investigating such a samba option. 
> (Still lots of questions:  should it be a "--with-utmp" option, a smb.conf
> option, into the system or separate utmpx/wtmpx files, ...?) 
> (*) We have 14,000 registered UNIX users.  At present just a handful are
> on samba;  this time next month it will be 4,000;  over the next two years
> it will rise to include all 14,000. 

I was quickly able to develop the first draft of a patch (against 2.0.4b) 
to enable utmp/wtmp logging, and it seems to be working fine in test mode.

The implementation is currently:
1. a "--with-utmp" configure option, to enable the possibility at all
   (somewhat akin to "--with-quotas" experimental option);

2. a global parameter "utmp directory" to say where the utmp/wtmp files
   are located;

3. a boolean service parameter, "utmp" to switch on utmp/wtmp logging
   for that service.

This should be quite flexible.  I'm slightly concerned that it might be
too complicated (and, in one respect, not as flexible as it might be).


1. Does it really need the "--with-utmp"?  This just detects system
   files such as <utmp.h> and <utmpx.h>, and if found, does some #defines
   to enable the code to be compiled in.  (Code *usage* only occurs when
   parameters are set.)

2. What should be the default location for "utmp directory"?  The same
   as the locking/stats directory (thus separate from system accounting)?
   Or the system accounting directory (e.g. "/var/adm" on Solaris 2.x)?

3. Should "utmp directory" (global string) and "utmp" (service boolean) be
   combined into, say, a per-service "utmp directory"?  (Implicit default
   behaviour of all services would be: no utmp/wtmp.  Also allows 
   different services to log in different places.)


:  David Lee                                I.T. Service          :
:  Systems Programmer                       Computer Centre       :
:                                           University of Durham  :
:  http://www.dur.ac.uk/~dcl0tdl            South Road            :
:                                           Durham                :
:  Phone: +44 191 374 2882                  U.K.                  :

More information about the samba-technical mailing list