[Samba] logon script

Liutauras Adomaitis liutauras.adomaitis at gmail.com
Wed Jun 3 18:57:26 GMT 2009


On Mon, Jun 1, 2009 at 1:09 PM, Christian Rost <cr at rocon-it.de> wrote:
> Hi,
>
> you don't have access to Samba variables from within your logon script. The most convenient way to solve this is by using the "ifmember.exe" executable from the Windows Server 2003 toolkit and to place it into your netlogon share - you need to google for ifmember.
>
> With ifmember.exe you can test, if the user who is running the logon script, belongs to the specified group. Use the following lines as an example and add it to your logon script:
>
> <....snip....>
> \\%SERVER01%\netlogon\ifmember.exe /verbose tech
> if errorlevel 1 goto TECH
> :STOPTECH
>
> \\%SERVER01%\netlogon\ifmember.exe /verbose mktg
> if errorlevel 1 goto MKTG
> :STOPMKTG
>
> goto END
>
> ##
> ## TECH group
> ##
> :TECH
> if exist k:\nul net use /delete k: /yes
> if not exist k:\nul net use k: \\%SERVER01%\tech /persistent:no
> goto STOPTECH
>
> ##
> ## MKTG group
> ##
> :MKTG
> if exist l:\nul net use /delete l: /yes
> if not exist l:\nul net use l: \\%SERVER01%\tech /persistent:no
> goto STOPMKTG
>
> :END
> rem This is the End of your script
>
> <...snip...>
>
> Cheers,
>
> Christian


I would suggest use ntlogon python script. Together with "root
preexec" and "root postexec" configuration options you can set up your
logon scripts to generated upon connecting to netlogon share.
I found this utility very useful and works very well. It supports
samba variables.
Mandriva ships this utility, so must other distributions.
There is problems with groups with spaces and capital letters, but it
is very easy to fix.

Liutauras


More information about the samba mailing list