Checking if Samba is running as an AD DC

Rowland penny rpenny at
Fri May 29 17:37:01 UTC 2020

On 29/05/2020 18:26, hezekiah maina via samba-technical wrote:
> Thanks. I tried out the different ways you gave.
> I also tried this:
> samba-tool testparm --parameter-name=serverrole
> which seems a little better as you don't have to provide the path to
> smb.conf which could vary with different installations.
> Well you can omit the samba-tool and get the same result with testparm but
> would have to press Enter to get the desired output.
> On Fri, May 29, 2020 at 9:33 AM Andrew Bartlett <abartlet at> wrote:
>> On Fri, 2020-05-29 at 09:24 +0300, Alexander Bokovoy via samba-
>> technical wrote:
>>> On to, 28 touko 2020, hezekiah maina via samba-technical wrote:
>>>> Hello everyone,
>>>> How else should I check that Samba is running as an AD DC apart
>>>> from
>>>> looking at the smb.conf file?
>>>> Is there a process that gives me this kind of information?
>>> For Cockpit integration you need to use systemd services to check
>>> whether a service is configured and enabled/started since that
>>> environment will anyway have systemd configured.
>>> systemctl is-enabled samba
>>> systemctl is-active samba
>>> For the config file checks, you can use 'testparm' utility:
>>> $ testparm --show-all-parameters -s|grep 'server role'
>>> server role=P_ENUM,auto|standalone server|standalone|member
>>> server|member|classic primary domain controller|classic backup domain
>>> controller|active directory domain controller|domain controller|dc,
>>> On non-DC system:
>>> $ testparm --section-name global --parameter-name 'server role' -s
>>> 2>/dev/null
>>> auto
>>> Checking configuration is needed anyway because you get information
>>> about the actual server role, not just that a service is running.
>> G'Day hezekia,
>> Welcome to the design session for your first bike shed!  ;-)
>> Try (eg):
>> testparm st/ad_dc/etc/smb.conf -s| grep "Server Role"
>> Andrew Bartlett
>> --
>> Andrew Bartlett             
>> Authentication Developer, Samba Team
>> Samba Developer, Catalyst IT
If you must use testparm (and that will not tell you if 'samba' is 
running), try this 'echo | testparm -s', instant output :D


More information about the samba-technical mailing list