1.5. Setting up Samba as an AD domain member server


If you are running an AD or NT4 domain, use Samba to add your Red Hat Enterprise Linux server as a member to the domain.

This helps you to gain the following:

  • Access domain resources on other domain members
  • Authenticate domain users to local services, such as sshd
  • Share directories and printers hosted on the server to act as a file and print server

1.5.1. Joining a RHEL system to an AD domain

Samba Winbind is an alternative to the System Security Services Daemon (SSSD) for connecting a Red Hat Enterprise Linux (RHEL) system with Active Directory (AD). You can join a RHEL system to an AD domain by using realmd to configure Samba Winbind. For more information see, the realm(8) man page on your system.

Procedure

  1. If your AD requires the deprecated RC4 encryption type for Kerberos authentication, enable support for these ciphers in RHEL:

    # update-crypto-policies --set DEFAULT:AD-SUPPORT
  2. Install the following packages:

    # dnf install realmd oddjob-mkhomedir oddjob samba-winbind-clients \
           samba-winbind samba-common-tools samba-winbind-krb5-locator krb5-workstation
  3. To share directories or printers on the domain member, install the samba package:

    # dnf install samba
  4. Backup the existing /etc/samba/smb.conf Samba configuration file:

    # mv /etc/samba/smb.conf /etc/samba/smb.conf.bak
  5. Join the domain. For example, to join a domain named ad.example.com:

    # realm join --membership-software=samba --client-software=winbind ad.example.com

    Using the previous command, the realm utility automatically:

    • Creates a /etc/samba/smb.conf file for a membership in the ad.example.com domain
    • Adds the winbind module for user and group lookups to the /etc/nsswitch.conf file
    • Updates the Pluggable Authentication Module (PAM) configuration files in the /etc/pam.d/ directory
    • Starts the winbind service and enables the service to start when the system boots
  6. Optional: Set an alternative ID mapping back end or customized ID mapping settings in the /etc/samba/smb.conf file.

    For details, see Understanding and configuring Samba ID mapping.

  7. Edit the /etc/krb5.conf file and add the following section:

    [plugins]
        localauth = {
            module = winbind:/usr/lib64/samba/krb5/winbind_krb5_localauth.so
            enable_only = winbind
        }
  8. Verify that the winbind service is running:

    # systemctl status winbind
    ...
       Active: active (running) since Tue 2018-11-06 19:10:40 CET; 15s ago
    중요

    To enable Samba to query domain user and group information, the winbind service must be running before you start smb.

  9. If you installed the samba package to share directories and printers, enable and start the smb service:

    # systemctl enable --now smb

Verification

  1. Display an AD user’s details, such as the AD administrator account in the AD domain:

    # getent passwd "AD\administrator"
    AD\administrator:*:10000:10000::/home/administrator@AD:/bin/bash
  2. Query the members of the domain users group in the AD domain:

    # getent group "AD\Domain Users"
        AD\domain users:x:10000:user1,user2
  3. Optional: Verify that you can use domain users and groups when you set permissions on files and directories. For example, to set the owner of the /srv/samba/example.txt file to AD\administrator and the group to AD\Domain Users:

    # chown "AD\administrator":"AD\Domain Users" /srv/samba/example.txt
  4. Verify that Kerberos authentication works as expected:

    1. On the AD domain member, obtain a ticket for the administrator@AD.EXAMPLE.COM principal:

      # kinit administrator@AD.EXAMPLE.COM
    2. Display the cached Kerberos ticket:

      # klist
      Ticket cache: KCM:0
      Default principal: administrator@AD.EXAMPLE.COM
      
      Valid starting       Expires              Service principal
      01.11.2018 10:00:00  01.11.2018 20:00:00  krbtgt/AD.EXAMPLE.COM@AD.EXAMPLE.COM
              renew until 08.11.2018 05:00:00
  5. Display the available domains:

    # wbinfo --all-domains
    BUILTIN
    SAMBA-SERVER
    AD

If you do not want to use the deprecated RC4 ciphers, you can enable the AES encryption type in AD. See Enabling the AES encryption type in Active Directory using a GPO.

1.5.2. Using the local authorization plug-in for MIT Kerberos

The winbind service provides {AD} users to the domain member. In certain situations, administrators want to enable domain users to authenticate to local services, such as an SSH server, which are running on the domain member. When using Kerberos to authenticate the domain users, enable the winbind_krb5_localauth plug-in to correctly map Kerberos principals to {AD} accounts through the winbind service.

For example, if the sAMAccountName attribute of an {AD} user is set to EXAMPLE and the user tries to log with the user name lowercase, Kerberos returns the user name in upper case. As a consequence, the entries do not match and authentication fails.

Using the winbind_krb5_localauth plug-in, the account names are mapped correctly. Note that this only applies to GSSAPI authentication and not for getting the initial ticket granting ticket (TGT).

Prerequisites

  • Samba is configured as a member of an {AD}.
  • Red Hat Enterprise Linux authenticates log in attempts against {AD}.
  • The winbind service is running.

Procedure

  • Edit the /etc/krb5.conf file and add the following section:

    [plugins]
    localauth = {
         module = winbind:/usr/lib64/samba/krb5/winbind_krb5_localauth.so
         enable_only = winbind
    }

    For more information, see the winbind_krb5_localauth(8) man page on your system.

1.5.3. Enabling certificate auto-enrollment on a Samba client

Certificate auto-enrollment is a function of the Active Directory (AD) Certificate Services. This feature enables users and devices enrollment for certificates without user interaction. Administrators can use certificates issued by the AD certificate authority (CA) in local services without manually monitor and renew certificates, which prevents disruptive outages.

If an AD provides a certificate authority (CA) and a RHEL host is a member of the AD, you can enable certificate auto-enrollment on the RHEL host. Samba then applies the auto-enrollment group policy from AD, and configures the certmonger service to request and manage certificates.

Prerequisites

  • Samba is configured as a member of an AD.
  • A Windows server in the AD has the Active Directory Certificate Services server role with the following services installed:

    • Certificate Authority
    • Certificate Enrollment
    • Policy Web Service
  • Internet Information Services (ISS) is configured to provide the certificate auto-enrollment feature over HTTPS.
  • ISS uses a certificate issued by the AD CA.
  • The Certificate Enrollment service supports Kerberos Authentication.
  • A group policy object (GPO) for certificate auto-enrollment is configured in AD.

Procedure

  1. Install the samba-gpupdate package:

    # dnf install samba-gpupdate
  2. Append the following settings to the /etc/samba/smb.conf file:

    kerberos method = secrets and keytab
    sync machine password to keytab = "/etc/krb5.keytab:account_name:sync_spns:spn_prefixes=host:sync_kvno:machine_password", "/etc/samba/cepces.keytab:account_name:machine_password"
    apply group policies = yes

    The settings specified in the Samba configuration include the following configuration:

    kerberos method = secrets and keytab
    Configures Samba to use the /var/lib/samba/private/secrets.tdb file first to verify Kerberos tickets and then the /etc/krb5.keytab file.
    sync machine password to keytab = <list_of_keytab_files_and_their_principals>
    Defines paths to keytab files that Samba maintains and the Kerberos principals in these files. With the shown value, Samba continues maintaining the /etc/krb5.keytab system keytab and, additionally, a /etc/samba/cepces.keytab file that the cepces-submit submission helper for certmonger uses to authenticate to the CA.
    apply group policies = yes
    Configures the winbind service to execute the gpupdate command in intervals. The update interval is 90 minutes, plus a random offset between 0 and 30 minutes.
  3. Create the /etc/samba/cepces.keytab file:

    # net ads keytab create
  4. Edit the /etc/cepces/cepces.conf file, and make the following changes:

    1. In the [global] section, set the server variable to the fully-qualified domain name (FQDN) of the Windows server which runs the CA service:

      [global]
      server=win-server.ad.example.com
    2. In the [kerberos] section, set the keytab variable to /etc/samba/cepces.keytab:

      [kerberos]
      keytab=/etc/samba/cepces.keytab
  5. Enable and start the certmonger service:

    # systemctl enable --now certmonger

    The certmonger service requests the certificates from the CA and automatically renews them before they expire.

  6. Manually run samba-gpupdate to ensure that the group policies have been loaded from AD:

    # samba-gpupdate
  7. The certmonger service stores the keys and certificates in the following directories:

    • Private keys: /var/lib/samba/private/certs/
    • Issued certificates: /var/lib/samba/certs/

      You can now start using the keys and certificates in services on the same host.

  8. Optional: Display the certificates that certmonger manages:

    # getcert list
    Number of certificates and requests being tracked: 1.
    Request ID 'AD-ROOT-CA.Machine':
    	status: MONITORING
    	stuck: no
    	key pair storage: type=FILE,location='/var/lib/samba/private/certs/AD-ROOT-CA.Machine.key'
    	certificate: type=FILE,location='/var/lib/samba/certs/AD-ROOT-CA.Machine.crt'
    	CA: AD-ROOT-CA
    	issuer: CN=AD-ROOT-CA,DC=ad,DC=example,DC=com
    	subject: CN=rhel9.ad.example.com
    	issued: 2025-03-25 14:22:07 CET
    	expires: 2026-03-25 14:22:07 CET
    	dns: rhel9.ad.example.com
    	key usage: digitalSignature,keyEncipherment
    	eku: id-kp-clientAuth,id-kp-serverAuth
    	certificate template/profile: Machine
    	profile: Machine
    	pre-save command:
    	post-save command:
    	track: yes
    	auto-renew: yes

    By default, the Windows CA issues only a certificate by using the Machine certificate template. If you configured additional templates in the Windows CA that apply for this host, certmonger requests certificates for these templates as well, and the getcert list output includes also entries for them.

Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2026 Red Hat
맨 위로 이동