Inhaltsverzeichnis

zurück

Samba mit LDAP oder Active Directory

Diese Anleitung zeigt, wie du Samba in ein zentrales Verzeichnisdienst-System integrierst – wahlweise über OpenLDAP oder Active Directory (AD). Dadurch entfällt die lokale Benutzerpflege auf dem Linux-Server.

🎯 Ziel

🧱 Voraussetzungen

🔁 OpenLDAP-Anbindung (ldapsam)

1. Benötigte Pakete

apt install samba libnss-ldap libpam-ldap nscd

2. smb.conf Ergänzungen

passdb backend = ldapsam:ldap://ldap.mash4077.local
ldap admin dn = cn=admin,dc=mash4077,dc=local
ldap suffix = dc=mash4077,dc=local
ldap user suffix = ou=Users
ldap group suffix = ou=Groups
ldap machine suffix = ou=Computers
ldap ssl = start_tls

3. LDAP-Struktur (Beispiel)

dc=mash4077,dc=local
├── ou=Users
│   └── uid=lars
├── ou=Groups
│   └── cn=smbgroup

4. Benutzer mit smbldap-tools oder LAM einpflegen

Siehe: openldap und: lam_setup

🧬 Active Directory-Anbindung (ADS-Modus)

1. Voraussetzungen

2. smb.conf Beispiel für ADS

workgroup = MASH
security = ADS
realm = MASH4077.LOCAL

idmap config * : backend = tdb
idmap config * : range = 3000-7999
idmap config MASH : backend = rid
idmap config MASH : range = 10000-999999

winbind use default domain = yes
winbind enum users = yes
winbind enum groups = yes

3. Domain-Join durchführen

net ads join -U Administrator

4. Testen

wbinfo -u      # AD-Benutzer anzeigen
getent passwd  # Benutzerauflösung testen

🔐 Rechtevergabe in Samba-Freigaben

valid users = MASH\\lars

Oder bei LDAP:

valid users = @smbgroup

🧠 Hinweise


Lars.Weiss@gmail.com?l|Lars Weiß Lars Weiß 10.07.2025 12:32