The next option run before logon is the
preexec
option, sometimes just called
exec
. This is an ordinary unprivileged command run by Samba as the user specified by the variable
%u
. For example, a common use of this option is to perform logging, such as the following:
[homes]
preexec = echo "%u connected to %S from %m (%I)\" >>/tmp/.log
Be warned that any information the command sends to standard output will not be seen by the user, but is instead thrown away. If you intend to use a
preexec
script, you should ensure that it will run correctly before having Samba invoke it.