Checking if Samba is running as an AD DC

Alexander Bokovoy ab at
Fri May 29 06:24:44 UTC 2020

On to, 28 touko 2020, hezekiah maina via samba-technical wrote:
> Hello everyone,
> I want to first express my gratitude to the entire Samba community.
> You have been kind and very responsive whenever I ask for help or advice.
> Thank you.
> 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 

Checking configuration is needed anyway because you get information
about the actual server role, not just that a service is running.

/ Alexander Bokovoy

More information about the samba-technical mailing list