Home Linux Authentication with Active Directory
Post
Cancel

Linux Authentication with Active Directory

This is a tutorial to access with an Active Directory user in a linux server.

For this tutorial we have the following devices:

  • Active Directory Server: IP 10.0.0.4
  • Linux Server: IP 10.0.0.5

Instalation of Active Directory

  1. we need a Windows server and adding the role of Active Directory.

AD server installation AD server installation part 2 AD server installation part 3 AD server installation part 4 AD server installation part 5

  1. Configure the domain

In this case the domain name is: lab.local

AD server configuration AD server configuration part 2 AD server configuration part 3

then next > install. Afterward, the server will reboot.

AD server configuration part 4

Check Connectivity

  1. Ensure the Linux server (in this case Centos7) responds to the domain.

Linux connectivity Linux connectivity part 2

Install requirements in Linux

  1. Install the following requirements in order to ensure a proper integration.

yum install sssd realmd oddjob oddjob-mkhomedir adcli samba-common samba-common-tools krb5-workstation openldap-clients policycoreutils-python

requirements

## Join the server to the Active Directory

  1. with an anccount of Active Directory execute this command: realm join --user=[userAD] [domain name]

join

  1. check that the server was joined
  • type those commands: realm list, id [userAD]@[domain name]

check check part 2

  • see the server in AD

check part 3

  1. modify sssd configuration

modify the file /etc/sssd/sssd.conf from this:

sssd

to this:

new sssd

This is used to allow auth without the domain name.

  • restart the service

restart

  • check that you can request info without write user@domain with this command: id [userAD]

id user

Auth with an ADUser in the Linux Server

We can do this by SSH. However, for this example I used only su command.

auth

Security Consideration

At this point all users from the Active Directory domain can log in the Linux server. However, they do not have sudo privileges. From a security view, we need to ensure that only allowed users can access to the server and not all. To solve that, we need to do the following steps:

  • deny access for all users with this command: realm deny --all
  • permit specific users or groups of Active Directory with those commands: realm permit [user]@domain_name, realm permit -g [groupname]@domain_name
  • restart sssd service
This post is licensed under CC BY 4.0 by the author.