Port 389: LDAP

Port 389 (TCP/UDP) is used by LDAP. Lightweight Directory Access Protocol: user directories such as Active Directory and OpenLDAP. Use LDAPS (636) or StartTLS.

389Port
TCP/UDPProtocol
ldapIANA service name
Authentication & directoryCategory

Port range

389 is a well-known (system) port (range 0–1023). On Linux and macOS, binding to it traditionally needs root or the CAP_NET_BIND_SERVICE capability.

Security

Only open port 389 to the hosts that need it. Prefer the encrypted variant of the protocol where one exists.

Open port 389 in a firewall

ufw         sudo ufw allow 389/tcp
            sudo ufw allow 389/udp
iptables    sudo iptables -A INPUT -p tcp --dport 389 -j ACCEPT
            sudo iptables -A INPUT -p udp --dport 389 -j ACCEPT
firewalld   sudo firewall-cmd --permanent --add-port=389/tcp
            sudo firewall-cmd --permanent --add-port=389/udp
Windows     New-NetFirewallRule -DisplayName "LDAP 389" -Direction Inbound -Protocol TCP -LocalPort 389 -Action Allow

Check if port 389 is open

nc -vz example.com 389
Test-NetConnection example.com -Port 389   # PowerShell
sudo ss -tulpn | grep ':389 '   # what is listening locally (Linux)

Other authentication & directory ports

Frequently asked questions

What is port 389 used for?
LDAP. Lightweight Directory Access Protocol: user directories such as Active Directory and OpenLDAP. Use LDAPS (636) or StartTLS.
Is port 389 TCP or UDP?
Both are assigned. Check which one your software actually listens on.