[Samba] Logon Script Via Group

Robert Schetterer robert at schetterer.org
Mon Oct 20 16:17:27 GMT 2008


Jeff L schrieb:
> Hello, 
> 
> In order to use Samba and migrate our Windows domain we need to be able to map users to a drive based on the Unix groups they are a member of.
> 
> IE:
> 
> If user is a member of finance, map drive f:\ finance
> If user is a a member of domainusers, run logon script logon.bat
> 
> 
> I tried placing differnet logon scripts in a directory named after the groupname and using the %g variable in Samba but it did not work.
> It only looks up the FIRST group ignoring the rest. 
> 
> Please let us know a easy way to do this. 
> 
> Thanks
> 
> 
> 
> 
> 
> =
> New York Film Academy
> Study Abroad Filmmaking & Acting. London, Paris, Florence, USA.
> http://a8-asy.a8ww.net/a8-ads/adftrclick?redirectid=160d32aa7f559fb3e9e7cf46485a3294
> 
> 
Hi,
you might give all users a default.bat
in this you may split running
other scripts by hostname username groupname
group can be matched with the ifmember.exe util
i.e default.bat

@echo off
REM default login script robert at schetterer.org
REM
-----------------------------------------------------------------------------------------------
REM exec bat for logged in machine ( maybe software status for machine )
echo %COMPUTERNAME%
call %COMPUTERNAME%.bat
REM
-----------------------------------------------------------------------------------------------
REM exec bat for login user
echo %USERNAME%
call %USERNAME%.bat
REM
---------------------------------------------------------------------------------------------
REM exec bat for different groups
REM ifmember.exe must be in the netlogon share download it at m$
REM be aware that ifmember will give result in the current win language
REM unlike normal dos
REM positive result from ifmember will match in errorlevel 1
ifmember /v /l "DOMAINNAME\Domain Users"
if errorlevel 1 call domainusers.bat
ifmember /v /l "DOMAINNAME\Domain Admins"
if errorlevel 1 call domainadmins.bat

and domainusers.bat

@echo off
REM install the pdfprinter drivers must allready be uploaded
REM typical use with cups-pdf
rundll32 printui.dll,PrintUIEntry /dn /n "\\YOUR-PDC-NAME\pdfprinter" /q
rundll32 printui.dll,PrintUIEntry /in /n "\\YOUR-PDC-NAME\pdfprinter"
net use z: \\YOUR-PDC-NAME\users /persistent:no

with such logic you should be able to solve
login stuff NT Group related

-- 
Best Regards

MfG Robert Schetterer

Germany/Munich/Bavaria


More information about the samba mailing list