[Samba] netlogon script generation

rruegner robowarp at gmx.de
Tue Dec 9 18:17:48 GMT 2003


Hi, here is an example start this script with root prexec in the netlogon
share
it will create netlogon bat files for users and groups which can
the orginal file is genlogon.pl
which is part of samba, read the doku, all other stuff is done by netlogon
bat files ( there are several examples in the web )
Best Regards

#!/usr/bin/perl
#
# login.pl
# creation on the fly logon scripts by robowarp at gmx.de inspired by
genlogon.pl
# Log client connection
#($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
open LOG, ">>/smbmonitor/user/netlogon.txt";
print LOG "$mon/$mday/$year $hour:$min:$sec - User $ARGV[0] Group $ARGV[1]\n
from $ARGV[2] in $ARGV[3]";
close LOG;

# Start generating logon script for user
open LOGON, ">/var/lib/samba/netlogon/$ARGV[0].bat";
print LOGON "\@ECHO OFF\r\n echo %USERNAME%\r\n call send.bat\r\n";

# Start generating logon script for machine for different security
monitoring
open LOGON, ">/var/lib/samba/netlogon/$ARGV[2].bat";
print LOGON "\@ECHO OFF\r\n call chkdir.bat\r\n call listapp.bat >
\\\\$ARGV[3]\\smbmonitor\\machines\\$ARGV[2]\\software\\$A$

# Start generating logon script for group
open LOGON, ">/var/lib/samba/netlogon/$ARGV[1].bat";
print LOGON "\@ECHO OFF\r\n";

# Connect shares for group users
if ($ARGV[1] eq "users")
{
print LOGON "NET USE X: \\\\$ARGV[3]\\files\r\n";
}

# Connect shares for group ntadmin
if ($ARGV[1] eq "ntadmin")
{
print LOGON "NET USE Y: \\\\$ARGV[3]\\smbmonitor\r\n";
}

----- Original Message ----- 
From: "Andrew Gaffney" <agaffney at technaut.darktalker.net>
To: <samba at lists.samba.org>
Sent: Tuesday, December 09, 2003 6:02 PM
Subject: [Samba] netlogon script generation


> Can anyone point me to a doc or a script that shows how to generate
netlogon script on the
>   fly and supports users having multiple groups? I tried the Perl script
referenced at
> <http://us2.samba.org/samba/docs/man/AdvancedNetworkManagement.html> but I
believe it only
> supports the user being a member of one group.
>
> -- 
> Andrew Gaffney
>
> -- 
> To unsubscribe from this list go to the following URL and read the
> instructions:  http://lists.samba.org/mailman/listinfo/samba
>



More information about the samba mailing list