[Samba] Login time logging?

mamue at lb-bbs1.emd.ni.schule.de mamue at lb-bbs1.emd.ni.schule.de
Sun Feb 1 19:49:04 GMT 2004

> On Fri, 2004-01-30 at 23:49, Remco Barendse wrote:
>> Hi all!
>> I need a setup that will log exactly when a user has logged in or out of
>> samba.
>> Preferably I would like to have a separate list per user, but this can
>> also be achieved with grep.
>> I found some solutions that rely on login script processing which is
>> nice
>> if your clients are running Win95/Win98 but for anything else it won't
>> work.
>> Anybody know of a solution?
> Many people enable utmp support on the server for this.

I have in [netlogon] a
root preexec = /usr/local/samba/bin/netlogon-preexec.sh %u %I %m %T
shell-script which does:
#1.: user, %u
#2.: Client-IP, %I
#3.: NetBIOS Machine name, %m
#4/5.: Timestamp, %T
#6.: Group, %g
#4/5 (Timestamp) are no longer used
/samba/netlogon/generateLoginBatch $1 $2 $3
echo "insert into logins (user, host, ip, date, time) values ('$1', '$3',
'$2', curdate(), curtime() );" | /usr/bin/mysql -u mysqlUser sambaLogins

Windows does (AFAIK) not have the concept of logout-scripts, so you'll
never know when people log out. When I have spare time I sometimes
generate a little machine-usage report from that data.

More information about the samba mailing list