[Samba] macro characters with pdbedit ?
Moray Henderson
Moray.Henderson at ict-software.org
Wed Apr 4 02:55:47 MDT 2012
> From: ciradhb.forward at laposte.net [mailto:ciradhb.forward at laposte.net]
> Sent: 03 April 2012 11:49
>
> Hi,
>
> I would like to change the Logon script name attributes of a samba user
> account to something like logon%u.cmd using pdbedit with the --script
> option. It does not work because the string logon%u.cmd is litteraly
> taken as the value, loosing the variable substitution at evaluation
> time. pdbedit -v output gives "Logon Script : logon%u.cmd" .
>
> When creating a user account without --script option, it takes by
> default the string that is specified in the smb.conf (say :
> logon%a.cmd) as a macro that will be evaluated later (pdbedit -v gives
> Logon Script: logonUNKNOWN.cmd which seems normal on linux).
>
> So my question is : is it possible to use macro characters with
> pdbedit the same way they are used in the smb.conf ? If not how can I
> change account attributes (and specifically the Logon Script Name) with
> macro charaters ? maybe with another tool than pdbedit ?
>
> Thanks in advance
>
> Henri
You could hard-code each user name into the Logon Script using a shell script to loop through the user database and pick out the names:
for u in `pdbedit -L | cut -d: -f1`; do
[[ $u =~ \\$ ]] && continue # Filter out machine accounts
echo pdbedit -S logon_$u.cmd -u $u
done
If it looks like the pdbedit commands are correct, remove the "echo".
Otherwise, you could try setting --script to whatever it gets when it picks up its value from "logon script" in smb.conf.
Moray.
“To err is human; to purr, feline.”
More information about the samba
mailing list