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

Thomas Bork tombork at web.de
Sat Jun 28 21:18:40 GMT 2003


Hi Peter Atkin,

you wrote:

> However i would like to do two things,
>
> 1) print samba veriables to a log file in a location of my choice
> 2) When a windows test user logs on, i would like to display a
> windowed dialog box showing the verious samba veriable stats.

this is what I do in my samba package for www.eisfair.org (adapted from
Joel ;):

#! /bin/sh
#----------------------------------------------------------------------
------
# /usr/local/bin/smbinfo - write info to /tmp/smbinfo
#
# Copyright (c) 2001-2003 Thomas Bork <tom at fli4l.de>
#
# Creation:     28.07.2002  tb
# Last Update:  12.11.2002  tb
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#----------------------------------------------------------------------
------

i=`echo "$1" | tr -s " "`
index=`echo "$i" | cut -d" " -f1`
value=`echo "$i" | sed 's/^. //'`
case $index in
T )  message="Datum/Zeit                                     (%$index)
= $value";;
d )  message="PID des Servers                                (%$index)
= $value";;
v )  message="Samba-Version                                  (%$index)
= $value";;
h )  message="(Internet)Hostname des Servers                 (%$index)
= $value";;
L )  message="NETBIOS-Name des Servers                       (%$index)
= $value";;
N )  message="NIS Heimat-Verzeichnis                         (%$index)
= $value";;
p )  message="Pfad des NIS-Heimatverzeichnisses              (%$index)
= $value";;
R )  message="Ausgehandeltes Protokoll-Level                 (%$index)
= $value";;
S )  message="Name der aktuellen Freigabe                    (%$index)
= $value";;
P )  message="Hauptverzeichnis der aktuellen Freigabe        (%$index)
= $value";;
U )  message="Vom Client angeforderter Benutzername          (%$index)
= $value";;
G )  message="Primaere Gruppe des angeforderten Benutzers    (%$index)
= $value";;
u )  message="Name des effektiven Benutzers                  (%$index)
= $value";;
g )  message="Primaerer Gruppenname des effektiven Benutzers (%$index)
= $value";;
H )  message="Heimatverzeichnis des effektiven Benutzers     (%$index)
= $value";;
I )  message="IP Adresse des Client-Rechners                 (%$index)
= $value";;
M )  message="(Internet)Hostname des Client-Rechners         (%$index)
= $value";;
m )  message="NETBIOS-Name des Client-Rechners               (%$index)
= $value";;
a )  message="Betriebssystem des Client-Rechners             (%$index)
= $value";;
esac

echo "$message" >> /tmp/samba-smbinfo


In smb.conf:

[public]
   comment = public directory on vmeis
   path = /public
   public = yes
   create mode = 0777
   directory mode = 0777
   browseable = yes
   writable = yes
   oplocks = no
   level2 oplocks = no
   blocking locks = no
   preexec = echo "\"T %T \" \"d %d \" \"v %v \" \"h %h \" \"L %L \"
\"N %N \"
                   \"p %p \" \"R %R \" \"S %S \" \"P %P \" \"U %U \"
\"G %G \"
                   \"u %u \" \"g %g \" \"H %H \" \"I %I \" \"M %M \"
\"m %m \"
                   \"a %a \"" | xargs -n1
/usr/local/bin/samba-smbinfo;\
             smbclient -U "eisfair Samba Server" -M %m
</tmp/samba-smbinfo;\
             rm -f /tmp/samba-smbinfo &
   vfs object = /usr/lib/samba/vscan-oav.so
   vfs options = config-file = /etc/vscan-oav.conf

The echo statement till "/usr/local/bin/samba-smbinfo;\" is one line.
Note that the file /tmp/samba-smbinfo holds the information and
smbclient sends this to the client. In my case this file will be
deleted after sending.

Sorry @all for the long lines (84 chars) in my message.


der tom




More information about the samba mailing list