Group logon Scripts

Brian Ginter brian.ginter at southern-air.com
Fri Jan 7 15:43:49 GMT 2000


I use the following script in the root preexec field for the netlogon 
share,called by tthis command:
perl /home/netlogon/logon_script %u %m %g

Then the logon script is set to :%u.bat

It works great with the only problem being with users belonging to 
multiple groups, this will only select the users primary group to 
create a logon script.

I am also including my root postexec script for the netlogon share.


#!/usr/bin/perl
#
# log when a user "logs into the network"
# and generate a custom logon script
#
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$month = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Sep', 'Oct', 'Nov', 'Dec')[$mon];
open LOG, ">>/var/log/samba/netlogon.log";
print LOG "$month $mday $hour:$min:$sec\t$ARGV[0] logged into $ARGV[1]\n";
close LOG;

$command = "rm /home/netlogon/$ARGV[0].bat";
open (COMMAND, "|bash");
print COMMAND $command;
close (COMMAND);

open LOGON, ">>/home/netlogon/$ARGV[0].bat";
print LOGON "\@echo off\r\n";
print LOGON "set pml=h:\\pmail\r\n";
print LOGON "set pmr=h:\\pmail\r\n";
print LOGON "NET USE X: \\\\titan\\$ARGV[0]\r\n";
print LOGON "NET USE H: \\\\titan\\H\r\n";
print LOGON "NET USE I: \\\\titan\\I\r\n";
print LOGON "NET USE V: \\\\titan\\V\r\n";

if ($ARGV[2] eq 'engineering') {
    print LOGON "NET USE J: \\\\titan\\J\r\n";
}

if ($ARGV[2] eq 'electrical') {
    print LOGON "NET USE G: \\\\titan\\G\r\n";
}

if ($ARGV[2] eq 'imaging') {
    print LOGON "NET USE S: \\\\roo\\smartcd\r\n";
    print LOGON "NET USE T: \\\\roo\\image_vol\r\n";
    print LOGON "NET USE U: \\\\roo\\sybase\r\n";
}

print LOGON "NET TIME \\\\titan /SET /YES\r\n";

close LOGON;

--------------------------------------------------------------------------------------------------


#!/usr/bin/perl
#
# log when a user "logs out of the network"
# and delete their logon script
#
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$month = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Sep', 'Oct', 'Nov', 'Dec')[$mon];
open LOG, ">>/var/log/samba/netlogon.log";
print LOG "$month $mday $hour:$min:$sec\t$ARGV[0] logged out.\n";
close LOG;

$command = "rm /home/netlogon/$ARGV[0].bat";
open (COMMAND, "|bash");
print COMMAND $command;
close (COMMAND);




On 8 Jan 00, at 2:16, Matthew Halliday wrote:

> We're almost at the stage of rolling out our new RH6.1/Samba server -
> one last item.  We have some 60 users and 7 departments.  Can I use/how
> do I use a logon script to log groups onto the server.  I currently have
> 1 logon script per user, but a small change in 1 share means updating
> every script.  Can I log them on by group ID but still map
> their personal shares with the %U flag so I then only have 7 scrpits?
> 
> -----------------------------------------------------------------------------------------------------------
> -----------------------------------------------------------------------------------------------------------
> Unless otherwise agreed expressly in writing by Fesa UK Limited, this
> communication should be treated as confidential and the information
> contained therein may not be used or disclosed except for the purpose
> for which it was sent. If you are not the intended recipient of this
> communication, please contact the sender immediately.
> WARNING: Computer viruses can be transmitted by e-mail. The recipient
> should check this e-mail and any attachments for the presence of
> viruses. Fesa UK Limited accepts no liability for any damage caused
> by any virus transmitted by this e-mail. This e-mail and any
> attachments may not be copied or forwarded without the written
> permission of Fesa UK Limited. In the event of any copying or
> forwarding, the recipient will be required to indemnify Fesa UK
> Limited against any claim for loss or damage caused by any viruses or
> otherwise.


Brian Ginter
brian.ginter at southern-air.com
(804) 385-1277
Southern Air, Inc.
http://www.southern-air.com



More information about the samba mailing list