Skip to main content

Active Directory (AD) is a technology developed by Microsoft to provide secure access and authentication for networks. It has become an essential tool in the IT industry, providing administrators with centralized control of user accounts and network resources. Since Active Directory service is developed by Microsoft, do you think Windows is the only operating system that provides Active Directory? The answer is no. Active Directory services could be built on the non-Windows platform. Ubuntu is one such open-source ono-Windows operating system built on Linux kernel that could be used to set up Active Directory service. This article will discuss how to set up an Active Directory on Ubuntu — an open-source operating system used mainly for server applications.

In this guide, we will go through step-by-step instructions on installing and configuring AD on Ubuntu servers. We’ll cover topics such as setting up a hostname, setting up a domain controller, setting up samba service as an Active Directory, installing Kerberos, adding users and groups to the directory, granting permissions to various resources, benefits of using Ubuntu as Active Directory server, and its drawbacks. In addition, best practices for managing your AD environment will be discussed.

By following these steps properly, readers can quickly deploy their own Active Directory setup on Ubuntu systems and start taking advantage of its features right away. The end result should be a stable, highly secure environment where users have access only to the resources they need and nothing more.

Table of Contents

What Is An Active Directory?

Active Directory (AD) is a directory service developed by Microsoft for Windows domain networks. It is included in most Windows Server operating systems as a set of processes and services. The AD allows administrators to manage permissions, user authentication, network resources and more from one centralized location. It provides an organized view of the entire network structure which can be used for security purposes, such as preventing unauthorized access.

The Active Directory stores information about objects on the network such as users, computers, devices, and other data related to their use. It also defines how each object interacts with other objects within the system. For example, it defines who has access to what files or folders. Administrators can control access rights using groups and policies that are assigned to individual users or machines.

In addition to providing secure management of resources, Active Directory also simplifies administration tasks like creating new accounts and managing group memberships. This makes it easier for IT staff to maintain efficient network operations without needing additional training or manual intervention. With these features, Active Directory becomes an invaluable tool for businesses with large networks comprising multiple sites and departments. Transitioning into the subsequent section about the benefits of using Ubuntu as an active directory server will provide further insight into this topic area.

Benefits Of Using Ubuntu as an Active Directory Server

Ubuntu is an open-source operating system that offers several benefits when used as an Active Directory Server. This section will discuss three of its primary advantages:

See Also Step by Step Procedure to Fix the New Ubuntu Overlayfs Vulnerability (CVE-2021-3493)

1. Security: Ubuntu’s security protocols are highly advanced and continually updated, making it a reliable platform for hosting sensitive data. It offers multiple layers of authentication and encryption to ensure the safety of all stored information.

2. Customization: The ability to customize the server according to one’s own needs makes Ubuntu stand out from other platforms. It provides various options for customizing servers, such as setting up roles and providing access control levels based on user requirements.

3. Cost Efficiency: Since Ubuntu is an open-source software, there are no licensing fees associated with using it as an Active Directory Server, thus reducing overall costs significantly compared to proprietary solutions. Additionally, most of the updates can be done remotely without requiring physical presence at each site or office location where Ubuntu is installed.

Overall, due to its strong security protocols, customization capabilities, and cost efficiency, Ubuntu serves as an ideal choice when deploying an Active Directory Server in any organization or business environment. Its versatility allows administrators to tailor their setup accordingly while ensuring secure storage of confidential data. With these features combined into one package, it is easy to understand why many organizations consider Ubuntu for this task. Transitioning seamlessly into the next section about prerequisites required for setting up an active directory on Ubuntu, we learn more about what preparations must first be made before beginning the implementation process.

Drawbacks Of Using Ubuntu As an Active Directory Server

Before we head towards setting up an Active Directory on Ubuntu, we should consider it’s caveat too. Despite its advantages, there are certain challenges that come with deploying Ubuntu as an active directory server due to compatibility issues between different versions of Windows OS and Linux distributions such as Ubuntu. Furthermore, there may also be difficulties related to migrating existing data from existing Windows servers over to a new Linux-based system which could potentially lead to costly downtime if not properly planned out beforehand. The following sections will explore these challenges in greater depth along with discussing possible solutions for mitigating them wherever possible.

Windows Active Directory Vs Ubuntu Active Directory

Windows Active Directory (AD) is a directory service created by Microsoft used to store and manage user, computer, and network resources. It is typically deployed on Windows Server operating systems for authentication and authorization of users in an organization’s IT environment. Ubuntu Active Directory, the open-source alternative to AD, provides similar but limited features when compared with its proprietary counterpart. Ubuntu Active Directory allows administrators to securely manage access policies within their networks as well as allows them to add or delete members from different groups.

However, one major drawback of using Ubuntu Active Directory is that it does not support many of the same features as found in Windows AD such as group policy objects or fine-grained password policies. Additionally, Ubuntu Active Directory cannot integrate with other non-Ubuntu applications which makes it challenging for organizations that work across multiple platforms. Furthermore, since Ubuntu Active Directory is relatively new software there are fewer experts available who can help troubleshoot any issues that may arise during deployment or management than those experienced in working with Windows AD.

See Also 5 Best C2 Framework for Red Teaming

Pros vs Cons of Using Ubuntu as an Active Directory Server

It’s worth noting the pros and cons of using Ubuntu as an Active Directory server too. Let’s list it out.

ProsCons
Customizable: Ubuntu is highly customizable, which could allow you to tailor the Active Directory server to your specific needs and preferences.Limited support: Ubuntu may have limited support compared to other commercial options, which could make it challenging to troubleshoot issues or seek assistance if needed.
Learning curve: Using Ubuntu as an Active Directory server may require a learning curve if you are not familiar with the Linux operating system, which could be time-consuming and potentially frustrating.Learning curve:Using Ubuntu as an Active Directory server may require a learning curve if you are not familiar with the Linux operating system, which could be time-consuming and potentially frustrating.
Secure: Ubuntu has a strong reputation for security, which could provide peace of mind knowing your data is secure.Potential compatibility issues: There may be potential compatibility issues when using Ubuntu as an Active Directory server with Windows-based systems or applications, which could impact functionality and productivity.

Prerequisites To Set Up An Active Directory On Ubuntu

Before attempting to set up an Active Directory on Ubuntu, there are a few prerequisites that must be met. The first is that the system requires an internet connection for installation and configuration of its components. It also requires root access privileges in order to gain full control over the server. Additionally, it is important to have basic knowledge of Linux commands as well as familiarity with the command-line interface (CLI). Furthermore, users should be aware of DNS configurations and various security settings such as firewall rules and user authentication methods.

In addition to these technical requirements, users must ensure they have all necessary software installed ahead of time including Samba, Kerberos 5, and Winbind services. These packages provide essential features for setting up a domain controller on Ubuntu. Moreover, installing additional packages like Realmd can further simplify the process by automating several administrative tasks related to configuring network resources such as computers and printers.

Furthermore, users need license agreements from Microsoft if their environment contains clients using Windows operating systems before beginning the setup process due to legal reasons. Without this agreement in place, certain aspects may not function properly or will not work at all within the Active Directory environment. Allowing sufficient time for researching each step involved in setting up an Active Directory will help create a smooth transition when implementing new technologies onto any organization’s infrastructure.

Step-by-Step Procedure to Set Up An Active Directory On Ubuntu

Time needed: 30 minutes.

How to Set Up An Active Directory On Ubuntu?

Without further delay, let’s start setting up an Active Directory on Ubuntu.

  1. Configure HostnameThe hostname is one of the most important entities in Active Directory/Domain Controller services. It is used by Samba’s internal DNS. Use this command to set the hostname.

    hostnamectl hostname dc

    Configure Hostname
  2. Check the hostname and the IP address of your Ubuntu serverUse these commands to check the hostname and IP address.

    hostnamectl

    ip a s


    Check the hostname and the IP address of your Ubuntu server
  3. Map the IP address with the hostnameEdit the hosts file using your favorite text editor. >ap the IP address with the hostname as shone in the below picture. We use nano editor to edit the etc/hosts in this demo.

    Sudo nano /etc/hosts



    Map the IP address with the hostname (1)
  4. Disable the system’s DNS resolver serviceWe need to disable the system’s resolver service as it keeps updates etc/resolv.conf.


    Use these commands to check the status of system’s resolver service, stop, and disable the service on reboot. Because just stooping the service will not survive the reboot.

    systemctl status systemd-resolved.service


    systemctl stop systemd-resolved.service


    systemctl disable systemd-resolved.service


    systemctl status systemd-resolved.service


    Disable the system’s DNS resolver service (1)
  5. Force the AD controller as the system’s DNS resolverEdit the etc/resolv.conf file and use the server IP as a nameserver and save the configuration to force the AD controller as the system’s DNS resolver.


    Note: We have added google’s DNS IP (8.8.8.8) as a fallback so that we can continue the installation.

    sudo nano /etc/resolv.conf


    Force the AD controller as the system’s DNS resolver (1)
  6. Check the system clock in synchronizedThis step is crucial as we need time synchronization for the active directory to work:

    timedatectl

    Check the system clock in synchronized (1)
  7. Install sambaSetting up an Active Directory (AD) on Ubuntu requires Samba, an open-source implementation of the SMB/CIFS networking protocol that allows you to create, manage, and authenticate users and groups in an Active Directory Domain Controller (AD DC) environment.


    We recommend updating your package index before installing Samba, in fact, any application.  Run these two commands to update the package index and install Samba and its client packages.

    sudo apt-get update


    sudo apt install samba smbclient


    Install samba on Ubuntu
  8. Provision Samba ADOne of the most important parts of this step is the generation of /var/lib/samba/private/krb5.conf. Samba gives us a suitable Kerberos configuration to use for our domain controller. Let’s back up the actual Samba configuration by removing the old one and using Samba interactive provisioning.


    Run these commands to locate the samba service file and take the backup of the file before making any changes, and provision samba AD.

    whereis samba


    sude mv /etc/samba/smb.conf /etc/samba/smb.conf.bk


    sudo samba-tool domain provision --use-rfc2307 --interactive


    Provision Samba AD (1)
  9. Install KerberosKerberos is a network authentication system based on the principle of a trusted third party. Let’s install it:


    As part of the Kerberos installation, you may need to configure the relam, Kerberos server, kerberos administrative server, and configurations. And take the backup of the kerberos configuration and replace with the one generated by the Samba provisioning process.

    sudo apt install krb5-admin-server


    sudo mb /etc/krb5.conf /etc/krb5.conf.orig


    sudo cp /var/lib/samba/private/krb5.conf /etc/krb5.conf


    Install Kerberos on Ubuntu
  10. Disable and mask unused samba servicesIn order to run the domain controller, you’ll have to disable sbmd, nmbd and winbind:

    sudo systemctl mask smbd nmbd winbind


    sudo systemctl disable smbd nmbd winbind


    Disable and mask unused samba services
  11. Start the samba-ad-dc serviceBefore we start we should unmask the service and start it.

    sudo systemctl unmask samba-ad-dc


    sudo systemctl start samba-ad-dc


    sudo systemctl status samba-ad-dc


    sudo systemctl enable samba-ad-dc


    Start the samba-ad-dc service
  12. List the Samba shares and test authentication with an administrator accountlist samba shares using this command, test authentication with our administrator account, and check if samba-ad-dc has configured the required DNS entries.

    smbclient -L localhost -N
    //list samba shares


    smbclient //localhost/netlogon -UAdministrator -c 'ls'
    //test authentication with our administrator account


    host -t SRV _ldap._tcp.securitymaster.dev
    //check if samba-ad-dc has configured the required DNS entries


    kinit administrator
    //request a kerberos ticket




    sudo samba-tool user list
    //check the default users on the Active directory


    List the samba shares and test authentication with administrator account

Leave a Reply