CYR_DBTOOL(8)

NAME
cyr_dbtool - Cyrus IMAP documentation

Manage Cyrus databases

SYNOPSIS

    cyr_dbtool [ -C config-file ] [ -b ] [ -c ] [ -N ] [ -n ] [ -R ] [ -S ] [ -T ] [ -t ]
            db-file db-backend action [ key ] [ value ]

DESCRIPTION

cyr_dbtool is used to manage a cyrusdb file. The usable actions are: show [<prefix>]

get <key>

set <key> <value>

delete <key>

consistent

repack

damage

batch

You may omit key or key/value and specify one per line on stdin. Keys are terminated by tab or newline, values are terminated by newline.

Running without any options will list the available database backends and usable actions.

The consistent action runs a consistency check on the DB by calling 'myconsistent' on it.

The repack action will compress the database by removing stale data on backends which support it. It's a NOOP otherwise.

The damage action makes the file dirty and then crashes, so it will need to be repaired. It's useful for testing crash recovery speed.

The batch action takes commands as bastrings on stdin, and writes results back out as bastrings.

cyr_dbtool reads its configuration options out of the imapd.conf(5) <#std-cyrusman-imapd.conf-5> file unless specified otherwise by -C.

Note: Note that the file locations are NOT read out of the configuration file, and must be supplied on the command line.

Tip: The format of all Cyrus databases is detailed in the distribution in file doc/internal/database-formats.html. Please consult that for details.

OPTIONS

-C config-file
    Use the specified configuration file config-file rather than the default imapd.conf(5) <#std-cyrusman-imapd.conf-5>.

-b, --base64
    If specified, all keys and values are provided in base64 format, making automation easier, particularly with batch. NOTE: the commands in batch mode are still in plain text, just the keys and values are encoded.

-c, --convert
    Convert the database file if the specified format on the command line doesn't match the database file's format.

-N, --no-checksum
    When reading, don't check checksums, and if the database supports it, create with a NULL checksum engine.

-n, --create
    Create the database file if it doesn't already exist.

-R, --readonly
    Open the database readonly. Even if --create is specified, will not create a database if it doesn't exists (since that needs writing). NOTE: you MUST use '-T' with '-R' as you'll stay in a read-only transaction for the entire time.

    With the twom backend, this will use an MVCC transaction which can run slowly without blocking any other processes.

-S, --no-sync
    If the backend supports it, don't fsync on commit (DANGEROUS). Useful for benchmarking.

-T, --use-transaction
    Use a transaction to do the action (most especially for 'show') - the default is to run without transactions

-t, --no-transaction
    A noop, since no transaction is already the default.

EXAMPLES

This series of examples address manipulating the user_deny.db database, which is used to deny users access to specific services. This is typically a Cyrus "flat" format database.

user_deny.db is indexed by userid and each record contains the database version number (currently 2), a list of "wildmat" patterns specifying Cyrus services to be denied, and a text message to be displayed to the user upon denial. The service names to be matched are those as used in cyrus.conf(5) <#std-cyrusman-cyrus.conf-5>. cyr_deny(8) <#std-cyrusman-cyr_deny-8> provides more convenient way to manage user_deny.db.

Note: Given that keys are tab-delimited, these examples use the notation <tab> to indicate the tab character. When entering this via the command line, remember to escape tabs. In a normal shell, one can do so with <ctrl-v> (^v). The sequence "<ctrl-v><ctrl-i>" (^v^i) works well to enter tab characters.

    cyr_dbtool /var/lib/imap/user_deny.db flat baduser "2<tab>pop3,imap<tab>Denied"
Deny the user 'baduser' access to imap and pop3.

    cyr_dbtool /var/lib/imap/user_deny.db flat show
Show all current database records.

    cyr_dbtool /var/lib/imap/user_deny.db flat get baduser
Get the current database record(s) for user 'baduser'.

FILES

/etc/imapd.conf

SEE ALSO

imapd.conf(5) <#std-cyrusman-imapd.conf-5>

Author
The Cyrus Team, Nic Bernstein (Onlight), Jeroen van Meeuwen (Kolab Systems), Bron Gondwana (Fastmail)

Copyright
1993–2026, The Cyrus Team