[Samba] login script

Gabriel Moll Ibacache gmoll at dcc.uchile.cl
Thu Jun 3 20:50:36 GMT 2004

Hi everybody! Here is my first question :)

I have a solaris machine running samba, and a lot of computers with
windows 2000. I need to generate a log file with the time when a user
logon into the machine and the time when the user logout.

I tryed the following ...

In the smb.conf I wrote in the [netlogon] section

     root preexec = /usr/local/samba/lib/mylogin.pl %T %u %m
     root postexec = /usr/local/samba/lib/mylogout.pl %T %u %m

The problem is I had only short connections. I mean, the log file tells
that users login for just 1 minute. I think maybe there is another samba
service that is making noise in the logfile. I mean other services are
treated like conections by the scripts mylogon and mylogout. Any idea
what's going on ? The scripts are below and thanks in advance.

# mylogin.pl

$date= shift;
$hour= shift;
$user = shift;
$machine = shift;
system("echo IN $date $hour $user $machine >>


# mylogout.pl

$date = shift;
$hour= shift;
$user = shift;
$machine = shift;
system("echo OUT $date $hour $user $machine >>

More information about the samba mailing list