ldapc
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.
Features
- 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
Installation
# From PyPI
pip install ldap-cli
# From source (editable, with dev deps)
pip install -e ".[dev]"
Quick Start
# 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-verify
Usage
Configure
ldapc configure
Prompts for LDAP host URL, base DN, bind DN, and password. Config is stored in ~/.ldapc/config.yaml; password goes to the OS keychain.
List
ldapc list users # all users
ldapc list groups # all groups
Search
ldapc search user john # users matching "john" (case-insensitive)
ldapc search group admin # groups matching "admin"
Get
ldapc get user jdoe # exact user lookup
ldapc get group devs # exact group lookup
Add / Delete
ldapc add user newuser
ldapc add group newgroup
ldapc delete user olduser
ldapc delete group oldgroup
Group Membership
ldapc user add group jdoe developers # add user to group
ldapc user remove group jdoe developers # remove user from group
Output Formats
ldapc list users --json # JSON output
ldapc list users --yaml # YAML output (simplified, human-friendly)
Global Flags
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 |
Help
ldapc --help # top-level help
ldapc get --help # subcommand help
ldapc --version # show version
Documentation
ldapc --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 paging
Running Tests
pip install -e ".[dev]"
python3 -m pytest tests/ -v
With coverage:
python3 -m pytest tests/ --cov=ldapc --cov-report=term-missing
License
MIT — see LICENSE for details.
Metadata
Release files for ldap-cli 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ldap_cli-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for ldap_cli-0.2.0-py3-none-any.whl |
Release files / ldap_cli-0.2.0-py3-none-any.whl
| Download URL | ldap_cli-0.2.0-py3-none-any.whl |
|---|---|
| Size | 32.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8db60baa929ca7b0b5c2bbc7938312efec311598256980e030c383941a488a97
|
|
BLAKE2b-256 checksum How to use checksums |
174c42f2488d778218b2b31af95436aa46296d4481ebebba51b0eda5a0b10140
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Security for ldap-cli 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.