[Samba] Samba Web Administration Tool (SWAT)

Steve Litt slitt at troubleshooters.com
Thu Oct 31 05:04:07 UTC 2019

On Wed, 30 Oct 2019 08:45:47 +0000
Rowland penny via samba <samba at lists.samba.org> wrote:

> On 29/10/2019 17:48, Steve Litt via samba wrote:
> > On Thu, 11 Jul 2019 11:59:20 +0000
> > Gerard Seibert via samba <samba at lists.samba.org> wrote:
> >  
> >> I know that this has probably been asked before. As a long time
> >> user of Samba, I remember using SWAT to configure Samba. It did
> >> seem, at least to me, to simplify things. At the very least, it
> >> did prevent me, and possibly other users, from creating simple
> >> syntax errors.  
> > Hi Gerard,
> >
> > I like programs like SWAT for just the reason you say: You don't
> > need to Eidetic memory every last option to prevent a simple syntax
> > error. The fact that you didn't receive an answer, and the fact
> > that I didn't receive an answer to the same question about six
> > years ago, leads me to conclude there's no such thing.  
> SWAT was removed quite some time ago, it had numerous problems, but
> we do have 'testparm'. This will check smb.conf for syntax errors
> etc. We also have a manpage for smb.conf 'man smb.conf', this shows
> all the possible parameters and the possible values for each
> parameter along with its default setting. There are also numerous
> other manpages and last, but not least, there is the Samba wiki: 
> https://wiki.samba.org/index.php/Main_Page
> Rowland

In that case, the following goes a long way toward what the OP wanted:

2>/dev/null testparm -sv | ./globalonly.awk | sort | dmenu -l 25

Where globalonly.awk follows:

#!/usr/bin/gawk -We

BEGIN { count = 0 }
/^\[/{ count++}
count == 1 {
	gsub(/^[ \t]/, "", $0)
	print $0

For extra credit, the OP can also run testparm without the -v, and use
a fairly simple algorithm to deduce which globals are set by smb.conf
and which are set by the program's default.

In the short time I worked on the task I wasn't able to get testparm
to tell me all the share property defaults, but there's probably a way
either with a workaround like mine or by copying testparm to a new file
and making that file recite everything.

Once you also have defaults and specified for shares, it wouldn't be
difficult at all to make something like SWAT out of it. IIRC SWAT
annoyingly deleted comments: I hope anyone making a similar program
leaves comments intact.


Steve Litt
Author: The Key to Everyday Excellence
Twitter: http://www.twitter.com/stevelitt

More information about the samba mailing list