[Samba] Group Login Scripts in Samba 2.2.3?

John Benedetto jbenedet at unm.edu
Sun Mar 24 14:51:04 GMT 2002


--On Saturday, March 23, 2002 11:56 AM +0000 "K. Hawkes" 
<k.hawkes at zombies.force9.net> wrote:

> What I was wondering is, what kind of code modifications would it take to
> allow a parameter of 'login.bat %U' so that when
> Samba sees that line, it executes login.bat with the parameter of %U (%U
> according to the SWAT docs means 'username')?
>
> I ask because I got curious as to whether GROUP login scripts would work,
> I coded a small C tool that parses the passwd and groups files (in /etc)
> to check for the existance of the user in question and to check what group
> they're in.  It then creates a 1-byte file
> in the /export/netlogon/test/groups directory of 'username-groupname'
> which my login.bat then checks for it's existence in the directory.  If
> it finds it, it calls the /export/netlogon/test/groups/<groupname>.bat
> file IF it exists.  I've tested my C tool and the batch files and they
> work fine, it led me to the conclusion above about the 'login script'
> smb.conf directive.
>
> Any ideas on this?

This question just came up in the last few weeks...

See http://www.phonax.com/fileservers/index.shtml for more information, as 
well as Richard Sharpe's Samba book from Que.

All you need do is add to your C program to write out a batch file that 
will be sent to the client, and executed there.

In the SMB.CONF you add an entry for a root preexec to execute your C 
program, and *THERE* you can use the variable substitution that you are 
unable to use on the login script = line.  Your line becomes
login script = %U.bat
(Your C program would create the file)...

Here is how you would set up your smb.conf:
[global]
logon script = %U.bat

[netlogon]
path = /dir/netlogon
root preexec = /dir/netlogon/logonscript %U %M %m %G
root postexec = rm /dir/netlogon/%U.bat

HTH...
- john




More information about the samba mailing list