A Python CLI tool for querying and managing LDAP directories. Provides a simple subcommand interface to list, search, get, add, and delete users and groups, with persistent configuration and secure credential storage via the OS keychain.
- List all users or groups
- Search users by name/uid, groups by name (case-insensitive substring)
- Get detailed info on a specific user or group
- Add and delete users and groups
- Manage group membership (add/remove users from groups)
- Text, JSON, and YAML output formats
- Persistent configuration in
~/.ldapc/config.yaml - Secure credential storage via OS keychain
- TLS-secured connections with optional certificate verification skip
- Debug logging for troubleshooting
# From PyPI
pip install ldap-cli
# From source (editable, with dev deps)
pip install -e ".[dev]"# Configure (host, base DN, bind DN, password)
ldapc configure
# List all users
ldapc list users
# Search for a user
ldapc search user john
# Get user details in YAML
ldapc get user jdoe --yaml
# Skip SSL verification (self-signed certs)
ldapc list users --skip-ssl-verifyldapc configurePrompts for LDAP host URL, base DN, bind DN, and password. Config is stored in ~/.ldapc/config.yaml; password goes to the OS keychain.
ldapc list users # all users
ldapc list groups # all groupsldapc search user john # users matching "john" (case-insensitive)
ldapc search group admin # groups matching "admin"ldapc get user jdoe # exact user lookup
ldapc get group devs # exact group lookupldapc add user newuser
ldapc add group newgroup
ldapc delete user olduser
ldapc delete group oldgroupldapc user add group jdoe developers # add user to group
ldapc user remove group jdoe developers # remove user from groupldapc list users --json # JSON output
ldapc list users --yaml # YAML output (simplified, human-friendly)These flags can appear after any subcommand:
| Flag | Env Var | Description |
|---|---|---|
--debug |
— | Enable debug logging to stderr |
--skip-ssl-verify |
LDAPC_SKIP_SSL_VERIFY=1 |
Skip TLS certificate verification |
--json |
— | Output as JSON |
--yaml |
— | Output as simplified YAML |
ldapc --help # top-level help
ldapc get --help # subcommand help
ldapc --version # show versionldapc --docs # list available doc files
ldapc --docs README.md # render README as rich text
ldapc --docs README.md --page # render with paging
ldapc --docs README.md --markdown # output raw markdown
ldapc --docs docs/README.md --page # view docs/README.md with pagingpip install -e ".[dev]"
python3 -m pytest tests/ -vWith coverage:
python3 -m pytest tests/ --cov=ldapc --cov-report=term-missingMIT — see LICENSE for details.