[Samba] logon scripts and variable substitution on the windows side

Helmut Hullen Hullen at t-online.de
Sat Dec 17 03:11:00 MST 2011

Hallo, nikos,

Du meintest am 17.12.11:

> i am really wondering a logon script stated in the config file with
> for example logon script = %L.bat

> can't contain inside variable substitutions from samba for example

> a script that it will have inside and it will be uploaded in the
> client to contain

> net use z: \\%L\%u to be translated to net use z: \\SERVER\username

If I have understood the system(s):

"%L" is a linux variable on the server,
"net use" is (mostly) a command which is run from/on a client (windows  
or Linux) which knows nothing about the servers'/samba's variables.

For those purposes I run on the server (in the "home" share) a command

	root preexec = /etc/samba/exec/parameter %u %a %g %m

which runs the linux/bash script "parameter", and "parameter writes a  
(windows) batch file into the user's home directory which contains lines  

@echo off
if a%Server% == a set Server=
set opsys=WinXP
set group=lehrer
set machine=__ffff_192.168.0.42

Viele Gruesse!

More information about the samba mailing list