Installing and configuring Samba-AD on RHEL8 and derivatives


EnterpriseLinux8 distribution and derivatives do not yet embed Samba-AD packages. Indeed Samba-AD relies on Heimdal Kerberos for Active Directory support while RedHat only distributes and supports products based on Kerberos-MIT.


Tranquil IT RPMs are currently validated for Redhat7 and Redhat8 (and derivatives like CentOS, AlmaLinux, OracleLinux, etc.). The latest version that will support Redhat7 is the Samba 4.12. Samba 4.12 will be out of support in September 2021. For later version only Redhat8 (and derivative) are supported.

If you want to stick to a community supported derivative of Redhat, we recommand to use AlmaLinux8.4 which we are currently using for building and testing.

Choosing the DNS suffix for the domain

For the choice of the domain name, there are two options:

  • use a DNS suffix ending in .lan, for example mydomain.lan;

  • use a sub-domain of a public domain you own, for example;


In any case it is absolutely necessary to avoid suffixes in .local because this suffix has been appropriated by Apple for its Bonjour protocol / mDNS.

In the instructions below, the domain name will be mydomain.lan which you will replace with the domain name of your choice.

Installing the RedHat8 or derivative server

To install a new Redhat8 (physical or virtual machine) without a GUI and only with the SSH service installed (minimal type installation), use this procedure for Redhat.

This documentation is also valid for a RedHat7 machine.


We recommend the installation of Samba-AD on Linux (Debian or CentOS), configured according to the ANSSI Recommendations for configuring a GNU / Linux system.

Configuring the network functions of your Redhat server

Configuring the DNS name


The name of your new Samba-AD server must not exceed 15 characters (limit linked to sAMAccountName in Active Directory). In this documentation we will use the name srvads.

The server name must be a FQDN name, i.e. the concatenation of the machine name and the DNS suffix.

  • modify the file /etc/hostname and fill in the FQDN name of the server;

  • edit /etc/hosts, fill in the name FQDN and the short name of the server:


  • on the line corresponding to the IP address of the Samba-AD server put first the FQDN name, then the short name;

  • do not modify the line(s) containing the term localhost:

# /etc/hosts of the Samba-AD server srvads.mydomain.lan srvads

Configuring the IP address

  • modify the file /etc/sysconfig/network-scripts/ifcfg-eth0 and set a static IP address. The file to modify can be different, for example ifcfg-ens0:

    # /etc/sysconfig/network-scripts/ifcfg-eth0 du serveur Samba-AD
  • apply the network configuration by rebooting the machine with a reboot;


If you have a corporate proxy.

To add the proxy to install Yum packages, add the following lines at the end of /etc/yum.conf adapting them to your context:


To configure the proxy for the different commands of the root user, add the following lines at the end of /root/.bashrc:

export http_proxy=http://proxy.mydomain.lan:3128
export https_proxy=http://proxy.mydomain.lan:3128
export ftp_proxy=http://proxy.mydomain.lan:3128
#export no_proxy=.lan,.local

To take this change into account immediately, do source /root/.bashrc.

Configuring the security of your CentOS server

  • after the reboot, set the system language to English to make it easier to find problems in the logs;

    localectl set-locale LANG=en_US.utf8
    localectl status
  • ensure that SELinux is deactivated:

    vi /etc/selinux/config

    Then in the file, replace the current value by (beware, you have to modify the line SELINUX= and not the line SELINUXTYPE=!):


    After reboot, check that SELinux is disabled, the sestatus command should return:

    SELinux status: disabled
  • configure firewall rules to open the ports necessary for Samba-AD to work:

    systemctl start firewalld
    systemctl enable firewalld
    firewall-cmd --zone=public --add-port=53/tcp --add-port=53/udp --permanent
    firewall-cmd --zone=public --add-port=88/tcp --add-port=88/udp --permanent
    firewall-cmd --zone=public --add-port=135/tcp --permanent
    firewall-cmd --zone=public --add-port=389/tcp --add-port=389/udp --permanent
    firewall-cmd --zone=public --add-port=445/tcp --permanent
    firewall-cmd --zone=public --add-port=464/tcp --add-port=464/udp --permanent
    firewall-cmd --zone=public --add-port=636/tcp --permanent
    firewall-cmd --zone=public --add-port=3268/tcp --permanent
    firewall-cmd --zone=public --add-port=3269/tcp --permanent
    firewall-cmd --zone=public --add-port=50000-51000/tcp --permanent
    firewall-cmd --zone=public --add-port=49152-65535/tcp --permanent
    systemctl restart firewalld
  • disable avahi-daemon (mDNS protocol / bonjour):

    systemctl stop avahi-daemon.service avahi-daemon.socket
    systemctl disable avahi-daemon.service avahi-daemon.socket

Configuring Additional Software Repositories

  • update CentOS7 and install the EPEL repository and some essential tools:

    yum update -y
    yum install -y epel-release
    yum install -y wget sudo screen nmap telnet tcpdump rsync net-tools bind-utils htop

You can now go to the next step and install Samba-AD on your CentOS.

Packages of the latest version 4.13 validated by the Tranquil IT team can be downloaded from the url When it will be necessary to upgrade to Samba-4.13, just change the repository url to and follow the upgrade notes on the upgrade page.

  • retrieve the RPM signature key and configure a YUM repository:

    wget -O /etc/pki/rpm-gpg/RPM-GPG-KEY-TISSAMBA-8
    rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-TISSAMBA-8
    echo "[tis-samba]
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-TISSAMBA-8" > /etc/yum.repos.d/tissamba.repo
  • verify the key fingerprint with sha256sum:

    sha256sum /etc/pki/rpm-gpg/RPM-GPG-KEY-TISSAMBA-8
        b3cd8395e3d211a8760e95b9bc239513e9384d6c954d17515ae29c18d32a4a11 /var/www/samba/RPM-GPG-KEY-TISSAMBA-8
  • install the Samba-AD packages for CentOS:

    yum install -y samba samba-dc samba-winbind samba-winbind-clients krb5-workstation ldb-tools bind chrony bind-utils samba-client

Instantiating the Active Directory Samba domain

Configuring Kerberos

  • modify the file /etc/krb5.conf and replace all its contents by the 4 following lines by specifying the Active Directory domain of your organization (here MYDOMAIN.LAN) :


The default_realm must absolutely be written in UPPERCASE LETTERS !

  default_realm = MYDOMAIN.LAN
  dns_lookup_kdc = false
  dns_lookup_realm = false

  kdc =

Configuring Samba

  • delete the file /etc/smb/smb.conf if it has already been generated (it will be regenerated by the instantiation command);

    rm -f /etc/samba/smb.conf
  • configure Samba with the role of domain controller. In the following line, you will think about changing both the name of the kerberos kingdom, and the short name of the domain (netbios name):

    samba-tool domain provision --realm=MYDOMAIN.LAN --domain MYDOMAIN --server-role=dc
  • reset the administrator password:

    samba-tool user setpassword administrator
  • check the line dns forwarder = in your /etc/samba/smb.conf. It must point to a valid DNS server, e.g.:

    dns forwarder =
  • reconfigure the DNS resolution for the local machine. In the /etc/sysconfig/network-scripts/ifcfg-xxxx file of the network interface, replace the following line:

  • restart NetworkManager to take into account the changes and check that the resolver has been reported in /etc/resolv.conf:

    systemctl restart NetworkManager
  • the Samba domain creation script creates an unnecessary /var/lib/samba/private/krb5.conf file. It must be removed and replaced by a symbolic link to the /etc/krb5.conf file:

    rm -f /var/lib/samba/private/krb5.conf
    ln -s /etc/krb5.conf /var/lib/samba/private/krb5.conf
  • activate Samba so that it starts automatically at the next reboot:

    systemctl enable samba
    systemctl start samba
  • reboot the machine with a reboot to verify that Samba reboots:

  • after rebooting, test that the kerberos is properly configured and that you get a TGT. Type the password for the administrator account you defined above with the command samba-tool setpassword. If it does not return anything or you get a message about the password expiration, it is fine).

    kinit administrator


    Samba-AD made the wise choice not to implement the translation of system accounts. The default Administrator is therefore administrator in English.

  • test the DNS:

    dig @localhost
    dig @localhost srvads.mydomain.lan
    dig -t SRV @localhost _ldap._tcp.mydomain.lan

Validating the new installation with a Windows client

You can now join a Windows client in your new domain.

To manage your new domain, the management interfaces must be installed on a Windows workstation. The Samba command line is efficient for many administrative tasks, and the RSAT graphical interfaces are a good complement to the command line.

To install the RSAT tools, follow the page on installing RSAT on your management machine.

Once RSAT is installed:

  • create and delete a DNS record from the DNS Active Directory console;

  • create and delete a user account or a machine account from the Users and Computers Active Directory console;

  • create a new GPO;

Great, if you have made it this far, then everything is going well and you have a new Samba Active Directory domain up and running.

Now we will configure the DNS service in BindDLZ mode to improve the performance of your Samba-AD.