Bug 1969 - preexec
Product: Samba 3.0
Classification: Unclassified
Component: Config Files
x86 Windows XP
: P3 normal
: none
Assigned To: Samba Bugzilla Account
Samba QA Contact
Depends on:
  Show dependency treegraph
Reported: 2004-10-25 09:02 UTC by Tilo Lutz
Modified: 2004-10-26 02:32 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Tilo Lutz 2004-10-25 09:02:32 UTC
preexec = echo $HOME > /tmp/homedir
don't work correct.
It always returns root homepath,
not user homepath.
Comment 1 Gerald (Jerry) Carter 2004-10-25 10:39:53 UTC
syntax should be

    preexec = echo %$(HOME) > /tmp/homedir 

However, samba does not initialize the user's 
logon evironment so I doubt that the $HOME variable 
will work at all.  

For the home directory path, you should be using

    preexec = echo %H > /tmp/homedir 
Comment 2 Tilo Lutz 2004-10-25 10:58:16 UTC

But than this behavior should be described in the man page.
Comment 3 Gerald (Jerry) Carter 2004-10-25 11:37:58 UTC
It is documented.  See the section on variables in 
the smb.conf(5) man page.
Comment 4 Tilo Lutz 2004-10-25 12:12:39 UTC

I took a look at man smb.conf and found
It describes how to use variables in config files.

But I didn't find any comment samba doesn't
set environment variables when using preexec.
Man programs will have a strange behavoir
without them.

Example: I use smbclient and preexec with the netlogon share
sending infos to users.
Although I call smbclient as user sender name will be displayed
as "root"
Comment 5 Björn Jacke 2004-10-26 02:32:15 UTC
isn't it obvious that environment variables of the samba server's environment
are meant? Anything else would be impossible.

About the HOME also see man page:
       %H     the home directory of the user given by %u.