[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
Re: [Samba] netlogon script generation
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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] To: [EMAIL PROTECTED] 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 -- To unsubscribe from this list go to the following URL and read the instructions: http://lists.samba.org/mailman/listinfo/samba
Re: [Samba] netlogon script generation
This was the script I was refering to that didn't work for me. I ended up re-writing almost completely from scratch to support multiple groups. #!/usr/bin/perl my ($user) = @ARGV; my $drives = {F = NET USE F: SKYLINE\\SKYLINEF\r\n, H = NET USE H: SKYLINE\\SHARE\r\n, I = NET USE I: SHIPPING1\\INVENTORY\r\n, M = NET USE M: SKYLINE\\SKYLINEM\r\n, S = NET USE S: SHIPPING1\\SHOP\r\n, Y = NET USE Y: ACCOUNTING\\FLTSCHOOL\r\n, Z = NET USE Z: ACCOUNTING\\MAINT\r\n}; my $which = {accounting = F H I M S Y Z, mech = I M S Z, dispatch = M, instructors = M}; my $groups = `cat /etc/group | grep ${user} | cut -d ':' -f 1`; $groups =~ s/\n/\:/sg; # Start generating logon script #open LOGON, /usr/local/samba/netlogon/${user}.bat; open LOGON, /tmp/${user}.bat; print LOGON [EMAIL PROTECTED] OFF\r\n; foreach $group (split /:/, $groups) { foreach $drive (split / /, $which-{$group}) { print LOGON $drives-{$drive}; } } close LOGON; system cat /tmp/${user}.bat | sort -u /usr/local/samba/netlogon/${user}.bat; rruegner wrote: 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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] To: [EMAIL PROTECTED] 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 -- Andrew Gaffney -- To unsubscribe from this list go to the following URL and read the instructions: http://lists.samba.org/mailman/listinfo/samba
Re: [Samba] netlogon script generation
On Tue, 2003-12-09 at 12:02, Andrew Gaffney wrote: 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. Deryk Robosson wrote some scripts that I modified to parse group membership (based upon /etc/group which may or may not be best). If you want to try them you can get them at http://scnc.lsd.k12.mi.us/~mrambo/netlogon-0.2.tar.gz I had planned on sending the group updates back to Deryk to see if he wanted to incorporate them into his release but I never got the preexec stuff to work so I never sent him the updates. You're welcome to give them a whirl. We are using the scripts daily but not in the way which was originally envisioned (much to my chagrin). If you can get the root preexec stuff to work I'd love to know how you do it. I tried repeatedly, even with some help from Deryk, and asked a least a couple of different times on this list for help but I can't get the root preexec to work for nothing. -- Mike Rambo [EMAIL PROTECTED] NOTE: In order to control energy costs the light at the end of the tunnel has been shut off until further notice... -- To unsubscribe from this list go to the following URL and read the instructions: http://lists.samba.org/mailman/listinfo/samba
Re: [Samba] netlogon script generation
Mike Rambo wrote: On Tue, 2003-12-09 at 12:02, Andrew Gaffney wrote: 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. Deryk Robosson wrote some scripts that I modified to parse group membership (based upon /etc/group which may or may not be best). If you want to try them you can get them at http://scnc.lsd.k12.mi.us/~mrambo/netlogon-0.2.tar.gz I had planned on sending the group updates back to Deryk to see if he wanted to incorporate them into his release but I never got the preexec stuff to work so I never sent him the updates. You're welcome to give them a whirl. We are using the scripts daily but not in the way which was originally envisioned (much to my chagrin). If you can get the root preexec stuff to work I'd love to know how you do it. I tried repeatedly, even with some help from Deryk, and asked a least a couple of different times on this list for help but I can't get the root preexec to work for nothing. I got the 'root preexec' to work without a problem: [netlogon] comment = The domain logon service path = /usr/local/samba/netlogon public = no writeable = no root preexec = /etc/samba/genlogon.pl %U I already posted my script in this thread. It also parses /etc/group to determine what groups a specific user is in. -- Andrew Gaffney -- To unsubscribe from this list go to the following URL and read the instructions: http://lists.samba.org/mailman/listinfo/samba