dbwrap_tool
Database schema and data management
SYNOPSIS
dbwrap_tool <name> <type> [args]
PARAMETERS
<name>
Logical database name (e.g., registry, secrets.tdb, sam)
<type>
Backend type (e.g., tdb1, ldb, tdb)
[args]
Operation and data (e.g., store key data, fetch key, traverse, delete key)
DESCRIPTION
The dbwrap_tool is a utility from the Samba suite designed to wrap database operations across different backends, primarily for testing and development purposes. It provides a unified interface to interact with databases like TDB (Trivial Database) and LDB, which are used in Samba for storing configuration data, registry entries, secrets, and more.
Samba tools such as samba-tool and smbd rely on dbwrap to abstract backend-specific calls, allowing seamless switching between file-based TDB and more advanced LDB (LDAP-like database). dbwrap_tool simulates this by taking a logical database name (e.g., 'registry', 'secrets.tdb'), a type (backend like 'tdb1' or 'ldb'), and operation arguments.
Common operations include store (write key-value), fetch (read), delete, traverse (list all), and exists. This tool is invaluable for debugging Samba's database interactions without running a full server instance. It outputs results in a simple text format, making it script-friendly.
Primarily used by Samba developers and advanced administrators, it's not intended for production data management but for backend validation and prototyping.
CAVEATS
Not for production use; lacks concurrency controls and error handling of full Samba daemons. Requires Samba development libraries. No man page; refer to Samba source code.
OPERATIONS
Supported args: store <key> <data>, fetch <key>, delete <key>, exists <key>, traverse, lock <key>.
EXAMPLES
dbwrap_tool registry tdb1 fetch 'HKLM\SOFTWARE\Samba'
dbwrap_tool secrets tdb store 'secretkey' 'secretvalue'
HISTORY
Introduced in Samba 4.0 (2012) as part of dbwrap refactoring for multi-backend support. Evolved with LDB integration in Samba 4.5+ to handle AD DC databases.
SEE ALSO
tdbtool(8), ldb(7), samba-tool(8), smb.conf(5)


