[Samba] Login scripts based on group

Simon Hobson shobson-lists at colony.com
Wed Nov 10 13:05:00 GMT 2004

Dean Landry wrote:
>I have users that belong to several groups.  I want a logon script 
>to be run for each of the groups to which a user belongs.  For 
>example, when I logon, I want admin.bat, users.bat, and 
>someothergroup.bat to run.  On Novell I used to use 'if Member of 
>groupName...', but I don't know how to do this in Samba..

Two ways :

1) Use ifmember in the main login script to check for group 
membership and call the appropriate scripts. ifmember is (IIRC) 
downloadable from the Microsoft web site.

2) Use the pre-exec facility of Samba to build a users login script 
on the fly each time they connect to the netlogon share. Use %u 
(again, IIRC) in the declaration of the login script parameter so 
that each users uses their own script, then write a script (executed 
on the host) that will build the login script (which of course can 
use any information available to the host scripting language) and set 
it as the pre-exec script for the share.

Mine is currently set up to use a common login script which makes all 
the decisions - and quite frankly it sucks due to the limited 
capabilities of DOS (unix with all the useful stuff removed) - I plan 
to change to method 2 when I get round to it.


Simon Hobson MA MIEE, Technology Specialist
Colony Gift Corporation Limited
Lindal in Furness, Ulverston, Cumbria, LA12 0LD
Tel 01229 461100, Fax 01229 461101

Registered in England No. 1499611
Regd. Office : 100 New Bridge Street, London, EC4V 6JA.

More information about the samba mailing list