Table of Contents

AD LDAP For Linux

Summary: How to use AD 2008 as a central authentication repository for a Suse Linux box.
Date: Around 2015
Refactor: 20 February 2025: Checked links and formatting.

The goal in this article is to enable Linux (SLES 11 SP1) boxes to use the Active Directory (2008) as the central directory for authentication.

Windows Server 2008

Identity Management For Unix

After installing the Windows Server 2008 and installing Active Directory on it you have to add Identity Management for Unix to the server:

Primary Group

Inside AD you have to create a group which will function as a primary group for users which will be logging into the linux systems. To do so, follow these steps:

adldapforlinux01.jpg

If the GID is not 10000 there are probably already unix enabled groups in the directory. Make sure the GID you enter is unique, although you will get a warning when the GID is not unique.

Bind User

Inside AD you have to create a user which will function as the bind user so anonymous login (which does not work by default) is not required. To do so, follow these steps:

adldapforlinux02.jpg

Linux Users

For each Active Directory user that you want to enable for UNIX logins, you will need to configure their UNIX attribute properties. For new users, follow these steps:

adldapforlinux03.jpg

SLES 11

Pre-configuration

After installing SLES 11 you need to install some additional packages:

Additionally you need to set these options:

search shift.local
nameserver 10.10.10.101
10.10.10.41     sles.shift.local sles
10.10.10.101    ad-ldaptest.shift.local ad-ldaptest

LDAP and Kerberos

Now all the requirements are set we can configure LDAP and Kerberos to be used for authentication. To do so, follow these steps:

Click on LDAP and enter these settings:

Now, click on Kerberos and enter these settings:

Now click OK in the Authentication Settings window. If you haven't installed the required software packages yet you'll be prompted to do so now.

ldap.cfg

Now, before you go on check the ldap.cfg file. The reason behond this is that SLES is owned by Novell and by default when you configure SLES for LDAP authenticatie it will be done for ldap authentication on eDirectory. See here if you want to know more about that, but now we're configuring for AD. The main problem we're now facing is the attribute mapping. eDirectory has a LDAP Server object which handles the LDAP attribute mapping. AD does not, so the attribute mapping must be done on the linux client. These are my settings, they are all by default included in the file but can be commented out:

sles:~ # cat /etc/ldap.conf | grep ^[a-z]
host    10.10.10.101
base    DC=shift,DC=local
uri     ldap://10.10.10.101/
binddn  sa_ldap@shift.local
bindpw  LD4Paccess
bind_policy     soft
pam_lookup_policy       yes
nss_initgroups_ignoreusers      root,ldap
nss_schema      rfc2307bis
nss_map_objectclass     posixAccount user
nss_map_objectclass     shadowAccount user
nss_map_attribute       uid sAMAccountName
nss_map_attribute       homeDirectory unixHomeDirectory
nss_map_attribute       shadowLastChange pwdLastSet
nss_map_objectclass     posixGroup group
nss_map_attribute       uniqueMember member
pam_login_attribute     sAMAccountName
pam_filter      objectclass=User
pam_password    ad
ssl     no
ldap_version    3
tls_checkpeer   no

nsswitch.cfg

Check this file as well:

passwd: files ldap
group:  files ldap
shadow: files ldap
hosts:  files dns
networks:       files dns

services:       files ldap
protocols:      files
rpc:    files
ethers: files
netmasks:       files
netgroup:       files ldap
publickey:      files

bootparams:     files
automount:      files nis
aliases:        files ldap
passwd_compat:  ldap

Login

Now everything is configured and if everything went well you can login:

login as: sjoerd
Using keyboard-interactive authentication.
Password:
Creating directory '/home/sjoerd'.
Creating directory '/home/sjoerd/.mozilla'.
Creating directory '/home/sjoerd/.fonts'.
Creating directory '/home/sjoerd/bin'.
/usr/bin/xauth:  creating new authority file /home/sjoerd/.Xauthority

sjoerd@sles:~>
sjoerd@sles:~>id
uid=10000(sjoerd) gid=10000(LDAP) groups=10000(LDAP)

Troubleshooting

Are your groups not synchronizing properly? Check your cache.

Resources