Basic Commands
Command | Description |
---|---|
ldapsearch -x | Search the LDAP directory using simple authentication |
ldapadd -x -D "cn=admin,dc=example,dc=com" -w <password> -f <ldif_file> | Add an entry to the LDAP directory |
ldapmodify -x -D "cn=admin,dc=example,dc=com" -w <password> -f <ldif_file> | Modify an entry in the LDAP directory |
ldapdelete -x -D "cn=admin,dc=example,dc=com" -w <password> <dn> | Delete an entry from the LDAP directory |
ldapwhoami -x -D "cn=admin,dc=example,dc=com" -w <password> | Check the credentials of the current user |
LDAP Operations
Operation | Description |
---|---|
Bind | Authenticate the user and establish a session |
Search | Search the directory for entries matching specific criteria |
Add | Add a new entry to the directory |
Modify | Modify an existing entry in the directory |
Delete | Delete an entry from the directory |
LDAP Filters
Filter | Description |
---|---|
objectClass=<class> | Search for entries with a specific object class |
cn=<name> | Search for entries with a specific common name |
uid=<name> | Search for entries with a specific user ID |
`( | (cn=John*)(cn=Mike*))` |
(&(objectClass=person)(sn=Smith)) | Search for entries with the object class “person” and a surname of “Smith” |
LDIF File Format
Format | Description |
---|---|
dn: <dn> | The distinguished name of the entry |
changetype: <type> | The type of change to be made (add, modify, or delete) |
<attribute>: <value> | The attribute and value to be added or modified |