[Samba] Listing samba 2.2.8a (redhat 8) verables to a text file

Thomas Bork tombork at web.de
Mon Jun 30 19:39:16 GMT 2003

Hi Peter Atkin,

you wrote:

> Thanks for the update, I had to do a little modification to your very
> good one liner.. I had problems getting consistent results, I found
> out running the "preexec" as "root" seemed to solve that.

you are right.
In my case the special smb.conf entry only will be created, if the
loglevel is >= 3 and smb.conf will be completely written via a shell
script from an config file.
Only root users can change the config file and create a new smb.conf via
the script. This is only meant for debugging purposes from root users
and thats why root preexec is not needed in my case.
www.eisfair.org uses a special configuration concept - if you are able
to read german, here ist a link to the documentation:


> I am very new to Linux and have major difficulty with user and
> directory rights, so i just did a work around.

I'm also not an expert and working mostly under Windows ;)

> This works very well so far, under both 2000 and XP, the "root
> preexec" is all on one line. their are still some querks like when
> this gets run via Terminal Services it does not display. but when a
> simple e.g.:
> [source]
>         browseable = yes
>         path = /mnt/nas/source
>         valid users = @admin
>         read only = yes
>         write list = @admin, root
>         force create mode = 0775
>         force group = admin
>         directory mask = 0775
>         preexec = smbclient -U %L -M %m
> </etc/samba/messages/source.txt
> Works well even under Terminal Services.

And /etc/samba/messages/source.txt holds the information from smbinfo?

> echo "$message" >> /etc/samba/scripts/smbinfo
> cp -f /etc/samba/scripts/smbinfo /mnt/nas/users/peter
> **** I have one question how can i direct the output of samba-smbinfo
> to say a home account of a user.
> e.g "/mnt/nas/users/%U" it seems when i do its i get "%U" as a file
> name.

You could move or copy the info to /mnt/nas/users/%U simply via

root preexec = echo "\"T %T \" [...] \"a %a \"" | xargs -n1
               smbclient -U "eisfair Samba Server" -M %m
               cp -f /etc/samba/scripts/smbinfo /mnt/nas/users/%U;\
               rm -f /etc/samba/scripts/smbinfo &

> Sorry for the long e-mail, and again thanks.

You are welcome :)

der tom

More information about the samba mailing list