The
[globals]
section appears in virtually every Samba configuration file, even though it is not mandatory to define one. Any option set in this section of the file will apply to all the other shares, as if the contents of the section were copied into the share itself. There is one catch: other sections can list the same option in their section with a new value; this has the effect of overriding the value specified in the
[globals]
section.
To illustrate this, let's again look at the opening example of the chapter:
[global]
log level = 1
max log size = 1000
socket options = TCP_NODELAY IPTOS_LOWDELAY
guest ok = no
[homes]
browseable = no
map archive = yes
[printers]
path = /usr/tmp
guest ok = yes
printable = yes
min print space = 2000
[test]
browseable = yes
read only = yes
guest ok = yes
path = /export/samba/test
In the previous example, if we were going to connect a client to the
[test]
share, Samba would first read in the
[globals]
section. At that point, it would set the option
guest
ok
=
no
as the global default for each share it encounters throughout the configuration file. This includes the
[homes]
and
[printers]
shares. When it reads in the
[test]
share, however, it would then find the configuration option
guest
ok
=
yes
, and override the default from the
[globals]
section with the value
yes
in the context of the
[pub]
share.
Any option that appears outside of a section (before the first marked section) is also assumed to be a global option.