I have a perl script that I'd like to use to create windows 9x login scripts at login time but I cannot get the process to work right. I have RedHat 7.3 (actually the k12ltsp v2.1.0 which is a modified RH7.3) set up as a domain controller which is working well. Manually created login scripts run fine on the workstations at login. I'm using a netlogon script I found at http://www.0x0a.com/netlogon.php that I've modified to handle multiple groups based upon group membership in /etc/group as I need. If I run the script from a command line supplying just a username it works ok. ./netlogon.pl mrambo #This results in a good script. When I put in a root preexec like... [netlogon] comment = Network Logon Service path = /home/netlogon guest ok = yes read only = yes browseable = no printable = no write list = @adm share modes = no root prexec = /home/netlogon/netlogon.pl %U root postexec = rm -f /home/netlogon/%U.bat it fails to run. My box was running samba 2.2.3a as distributed w/RH7.3. When I inserting the root preexec statement in smb.conf the domain logons would no longer function. I received a no domain controller error message. I could still manually map drives after clicking ok at the error message though. I could not see anything in the logs related to preexec or domain logon problems at log level 2. I couldn't get log level 3 to work for some reason on the RH supplied samba so I upgraded to the 2.2.6 samba binaries on samba.org. I still get the same no domain controller error on the workstation but now with the added 'feature' that it also seems to hang an nmbd process on the server. Help!!! I worked on this almost all day Saturday including searching the samba archives on marc.theaimsgroup.com and I'm out of ideas. Thanks. -- Mike Rambo mrambo@lsd.k12.mi.us
On Mon, 28 Oct 2002 10:44 pm, Mike Rambo wrote: [SNIP]> scripts run fine on the workstations at login. I'm using a netlogon > script I found at http://www.0x0a.com/netlogon.php that I've modified to > handle multiple groups based upon group membership in /etc/group as I > need. If I run the script from a command line supplying just a username > it works ok. > > ./netlogon.pl mrambo #This results in a good script.Okay, it appears that you have XML-Twig installed and the script is functioning from the command line as it should be. I have this script working in production environments on samba 2.2.2 (machine needs to be upgraded..client is stalling ;)) and 2.2.6 configurations without any trouble.> [netlogon] > comment = Network Logon Service > path = /home/netlogon > guest ok = yes > read only = yes > browseable = no > printable = no > write list = @adm > share modes = no > root prexec = /home/netlogon/netlogon.pl %U > root postexec = rm -f /home/netlogon/%U.batLooks good to me..quite similar to what I normally use. Perhaps someone else can shed some light on the issue..though I think the log level should probably be a bit higher. -- Regards, Deryk Robosson Robosson Business Services 22 Flemington Street Albany, WA 6330 ABN: 56 728 377 499 Phone: +61 4 0842 9835 Email: deryk@0x0a.com
Mike, In case you still need a configurable login script ... Add to [netlogon] share: root preexec = perl /usr/local/samba/lib/genlogon.pl %u %g %m root postexec = perl /usr/local/samba/lib/genlogoff.pl %u Good luck, Uli ------------------------------------------- #!/usr/bin/perl # # genlogon.pl # smb.conf: # root preexec = genlogon.pl %u %g %m # use Time::localtime; ($username, $groupname, $pcname) = @ARGV; $server = SERVER_NETBIOSNAME; my $tm = localtime(); $datestring = sprintf "%02d.%02d.%04d",$tm->mday, $tm->mon + 1, $tm->year + 1900; $logdateiname = sprintf ">>/usr/local/samba/var/netlogon.log"; open (logfile, $logdateiname); printf logfile "%s - %02d:%02d:%02d : User \"%s\" \t group \"%s\" logs in %s \n", $datestring, $tm->hour, $tm->min , $tm->sec, $username, $groupname, $pcname; close logfile; # Start login script: open LOGON, ">/usr/local/samba/netlogon/$username.bat"; print LOGON "\@ECHO OFF\r\n"; # Home shares print LOGON "NET USE Z: \\\\$server\\$username /persistent:no\r\n"; # Shares for individual groups if ($groupname eq "GROUP" || $groupname eq "group") { print LOGON "NET USE X: \\\\$server\\SHARE1 /persistent:no\r\n"; print LOGON "NET USE Y: \\\\$server\\SHARE2 /persistent:no\r\n"; } # Close output file close LOGON; -------------------------------------------- #!/usr/bin/perl # # genlogoff.pl system("rm /usr/local/samba/netlogon/$ARGV[0].bat"); ---------------------------------------------