TSF – Giải pháp IT toàn diện cho doanh nghiệp SMB | HCM

P6 - Configure SnipeIT LDAP and Auto Synchronization on Ubuntu Server

🖥️ Snipe-IT P6 – Configure LDAP Integration on Ubuntu Server (Active Directory + Auto Sync)

Snipe-IT is a powerful and widely used open-source IT asset management system trusted by organizations worldwide. When deployed in a corporate environment, integrating Snipe-IT with Active Directory via LDAP becomes essential for centralized authentication and automated user management.

In this guide, you will learn how to configure LDAP integration in Snipe-IT on Ubuntu Server, connect it to Active Directory, and enable automatic synchronization using cron jobs.

This tutorial covers:

✔ Installing required LDAP extensions
✔ Configuring DNS and domain connectivity
✔ Setting up LDAP parameters in Snipe-IT
✔ Running manual LDAP sync
✔ Automating synchronization with cron
✔ Troubleshooting common LDAP issues

This article is ideal for:

  • IT Helpdesk Engineers

  • System Administrators

  • Infrastructure Engineers

  • Anyone running Snipe-IT in a corporate environment


🏗️ Environment Information

Before starting, confirm your environment:

  • Domain Controller (DC): 192.168.16.186

  • Domain: tsf.local

  • Snipe-IT Server (Ubuntu): 192.168.16.208

Snipe-IT is running on Ubuntu Server with Apache.


⚙️ Step 1 – Install LDAP Extension on Ubuntu

Snipe-IT requires the PHP LDAP extension to communicate with Active Directory.

Update package list:

 
sudo apt update

Install LDAP extension:

 
sudo apt install php8.2-ldap

Restart Apache web server:

 
sudo systemctl restart apache2

✅ After this step, the Ubuntu server is ready to communicate with LDAP services.


🔐 Step 2 – Join Domain and Configure LDAP

This section includes preparation on the Domain Controller and configuration on the Snipe-IT server.


#1: On Domain Controller – Create LDAP User

On your Domain Controller (192.168.16.186), create a service account:

 
Username: snipe Password: Abc@1234

This account will be used by Snipe-IT to bind and query Active Directory.


#2: On Snipe-IT Server – Configure DNS to Point to DC

Snipe-IT must use the Domain Controller as its DNS server.

Edit netplan configuration:

 
sudo nano /etc/netplan/50-cloud-init.yaml

Apply configuration:

 
sudo netplan apply

Configuration content:

💻
filename.bash
network:
  version: 2
  ethernets:
    ens18:
      dhcp4: no
      addresses:
        - 192.168.16.208/24
      nameservers:
        addresses:
          - 192.168.16.186  # IP DC
          - 8.8.8.8
      routes:
        - to: 0.0.0.0/0
          via: 192.168.16.1

This ensures domain name resolution works correctly for tsf.local.


#3: Configure LDAP Settings in Snipe-IT

Now configure LDAP parameters inside Snipe-IT:

 
Active Directory domain: tsf.local
Ldap server: ldap://tsf.local
Ldap Bind Username: snipe@tsf.local
Ldap Bind Password: Abc@1234
Base Bind DN: DC=tsf,DC=local
Ldap Filter: &(objectClass=person)
Ldap Authentication query: sAMAccountName=%username%
 

🔎 What These Settings Do:

  • Connects Snipe-IT to your domain

  • Authenticates using the service account

  • Filters only user objects

  • Allows login using sAMAccountName

Once saved, test authentication to verify the connection.


🔄 Step 3 – Manual LDAP Sync

Before enabling automation, test LDAP synchronization manually.

Run the command:

 
cd /var/www/snipe-it sudo php8.2 artisan snipeit:ldap-sync

If successful, users from Active Directory will be imported into Snipe-IT.

Always confirm manual sync works before enabling auto-sync.


⏰ Step 4 – Enable Automatic LDAP Sync (Cron Job)

To automate synchronization, configure a cron job.

Open root crontab:

 
sudo crontab -e

Add the following line:

 
*/30 * * * * cd /var/www/snipe-it && /usr/bin/php8.2 artisan snipeit:ldap-sync >> /var/log/snipeit-ldap.log 2>&1

📌 Explanation:

  • Runs every 30 minutes

  • Changes directory to Snipe-IT path

  • Executes LDAP sync command

  • Logs output to /var/log/snipeit-ldap.log

Although this example runs every 30 minutes, you can adjust the schedule based on organizational needs.


🛠️ Common LDAP Troubleshooting Tips

If synchronization fails, check:

✔ DNS resolution (ping tsf.local)
✔ LDAP extension installed correctly
✔ Bind account password
✔ Firewall between Ubuntu and DC
✔ Log file: /var/log/snipeit-ldap.log

Most LDAP issues are related to DNS or incorrect bind credentials.


🎯 Final Result

After completing all steps:

✅ Snipe-IT is integrated with Active Directory
✅ Users authenticate using domain credentials
✅ LDAP sync runs automatically every 30 minutes
✅ Manual user management is eliminated
✅ Asset management becomes centralized and accurate

You now have a fully functional enterprise-ready Snipe-IT LDAP integration on Ubuntu Server.

See also related articles

P13 – Ultimate QR Code SnipeIT Setup Made Easy

P13 – Ultimate QR Code SnipeIT Setup Made Easy SnipeIT – P13 QR Code Setup Guide | Create and Print Asset QR Codes Managing IT assets without proper labeling can quickly become chaotic.When devices move between departments, employees leave, or audits happen, identifying assets manually wastes time and increases errors....

Read More

P12 – Ultimate Bulk Method to Check In Check Out Assets in SnipeIT

P12 – Ultimate Bulk Method to Check In Check Out Assets in SnipeIT SnipeIT – P12 The Fastest Way to Check-In & Check-Out Assets in Snipe-IT (Bulk Method) Managing a few devices manually is easy. Managing 100–500 assets during onboarding, offboarding, or department transfers? That’s a different story. If you...

Read More

P11 – Ultimate Guide to Check In Check Out in SnipeIT

P11 – Ultimate Guide to Check In Check Out in SnipeIT SnipeIT – P11 How to Manage Check In Check Out in SnipeIT (Step-by-Step) Efficient asset tracking is the backbone of every IT department. If you cannot accurately manage Check In check Out in SnipeIT, your asset database quickly becomes...

Read More