[Samba] Login time logging?
samba at vaag.nu
Sun Feb 1 22:33:22 GMT 2004
Thanks for your input!
On another mailing list I found a message from somebody who used the same
command to log logging out. I use it on the share everybody connects to
and it seems to work ok :)
root preexec = /bin/sh -c 'echo "[%T] %u connects from %m (%I)" >>
root postexec = /bin/sh -c 'echo "[%T] %u disconnects from %m (%I)" >>
I'm collecting the data per user.
Maybe it is possible with mysql too, to keep a table for each machine or
Now all we need is a nice script to make some stats of the data :)
On Sun, 1 Feb 2004 mamue at lb-bbs1.emd.ni.schule.de wrote:
> > 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