{
    "mode": "man",
    "parameter": "systemd-cryptenroll",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/systemd-cryptenroll/1/json",
    "generated": "2026-06-10T11:38:26Z",
    "synopsis": "",
    "sections": {
        "NAME": {
            "content": "systemd-cryptenroll - Enroll PKCS#11, FIDO2, TPM2 token/devices to LUKS2 encrypted volumes\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "",
            "subsections": [
                {
                    "name": "systemd-cryptenroll [OPTIONS...] [DEVICE]",
                    "content": ""
                }
            ]
        },
        "DESCRIPTION": {
            "content": "systemd-cryptenroll is a tool for enrolling hardware security tokens and devices into a LUKS2\nencrypted volume, which may then be used to unlock the volume during boot. Specifically, it\nsupports tokens and credentials of the following kind to be enrolled:\n\n1. PKCS#11 security tokens and smartcards that may carry an RSA key pair (e.g. various\nYubiKeys)\n\n2. FIDO2 security tokens that implement the \"hmac-secret\" extension (most FIDO2 keys,\nincluding YubiKeys)\n\n3. TPM2 security devices\n\n4. Recovery keys. These are similar to regular passphrases, however are randomly generated\non the computer and thus generally have higher entropy than user chosen passphrases.\nTheir character set has been designed to ensure they are easy to type in, while having\nhigh entropy. They may also be scanned off screen using QR codes. Recovery keys may be\nused for unlocking LUKS2 volumes wherever passphrases are accepted. They are intended to\nbe used in combination with an enrolled hardware security token, as a recovery option\nwhen the token is lost.\n\n5. Regular passphrases\n\nIn addition, the tool may be used to enumerate currently enrolled security tokens and wipe a\nsubset of them. The latter may be combined with the enrollment operation of a new security\ntoken, in order to update or replace enrollments.\n\nThe tool supports only LUKS2 volumes, as it stores token meta-information in the LUKS2 JSON\ntoken area, which is not available in other encryption formats.\n",
            "subsections": []
        },
        "LIMITATIONS": {
            "content": "Note that currently when enrolling a new key of one of the five supported types listed above,\nit is required to first provide a passphrase or recovery key (i.e. one of the latter two key\ntypes). For example, it's currently not possible to unlock a device with a FIDO2 key in order\nto enroll a new FIDO2 key. Instead, in order to enroll a new FIDO2 key, it is necessary to\nprovide an already enrolled regular passphrase or recovery key. Thus, if in future key\nroll-over is desired it's generally recommended to combine TPM2, FIDO2, PKCS#11 key\nenrollment with enrolling a regular passphrase or recovery key.\n\nAlso note that support for enrolling multiple FIDO2 tokens is currently not too useful, as\nwhile unlocking systemd-cryptsetup cannot identify which token is currently plugged in and\nthus does not know which authentication request to send to the device. This limitation does\nnot apply to tokens enrolled via PKCS#11 — because tokens of this type may be identified\nimmediately, before authentication.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "The following options are understood:\n",
            "subsections": [
                {
                    "name": "--password",
                    "content": "Enroll a regular password/passphrase. This command is mostly equivalent to cryptsetup\nluksAddKey, however may be combined with --wipe-slot= in one call, see below.\n",
                    "long": "--password"
                },
                {
                    "name": "--recovery-key",
                    "content": "Enroll a recovery key. Recovery keys are most identical to passphrases, but are computer\ngenerated instead of human chosen, and thus have a guaranteed high entropy. The key uses\na character set that is easy to type in, and may be scanned off screen via a QR code.\n\n--pkcs11-token-uri=URI\nEnroll a PKCS#11 security token or smartcard (e.g. a YubiKey). Expects a PKCS#11\nsmartcard URI referring to the token. Alternatively the special value \"auto\" may be\nspecified, in order to automatically determine the URI of a currently plugged in security\ntoken (of which there must be exactly one). The special value \"list\" may be used to\nenumerate all suitable PKCS#11 tokens currently plugged in. The security token must\ncontain an RSA key pair which is used to encrypt the randomly generated key that is used\nto unlock the LUKS2 volume. The encrypted key is then stored in the LUKS2 JSON token\nheader area.\n\nIn order to unlock a LUKS2 volume with an enrolled PKCS#11 security token, specify the\npkcs11-uri= option in the respective /etc/crypttab line:\n\nmyvolume /dev/sda1 - pkcs11-uri=auto\n\nSee crypttab(5) for a more comprehensive example of a systemd-cryptenroll invocation and\nits matching /etc/crypttab line.\n\n--fido2-device=PATH\nEnroll a FIDO2 security token that implements the \"hmac-secret\" extension (e.g. a\nYubiKey). Expects a hidraw device referring to the FIDO2 device (e.g.  /dev/hidraw1).\nAlternatively the special value \"auto\" may be specified, in order to automatically\ndetermine the device node of a currently plugged in security token (of which there must\nbe exactly one). The special value \"list\" may be used to enumerate all suitable FIDO2\ntokens currently plugged in. Note that many hardware security tokens that implement FIDO2\nalso implement the older PKCS#11 standard. Typically FIDO2 is preferable, given it's\nsimpler to use and more modern.\n\nIn order to unlock a LUKS2 volume with an enrolled FIDO2 security token, specify the\nfido2-device= option in the respective /etc/crypttab line:\n\nmyvolume /dev/sda1 - fido2-device=auto\n\nSee crypttab(5) for a more comprehensive example of a systemd-cryptenroll invocation and\nits matching /etc/crypttab line.\n\n--fido2-with-client-pin=BOOL\nWhen enrolling a FIDO2 security token, controls whether to require the user to enter a\nPIN when unlocking the volume (the FIDO2 \"clientPin\" feature). Defaults to \"yes\". (Note:\nthis setting is without effect if the security token does not support the \"clientPin\"\nfeature at all, or does not allow enabling or disabling it.)\n\n--fido2-with-user-presence=BOOL\nWhen enrolling a FIDO2 security token, controls whether to require the user to verify\npresence (tap the token, the FIDO2 \"up\" feature) when unlocking the volume. Defaults to\n\"yes\". (Note: this setting is without effect if the security token does not support the\n\"up\" feature at all, or does not allow enabling or disabling it.)\n\n--fido2-with-user-verification=BOOL\nWhen enrolling a FIDO2 security token, controls whether to require user verification when\nunlocking the volume (the FIDO2 \"uv\" feature). Defaults to \"no\". (Note: this setting is\nwithout effect if the security token does not support the \"uv\" feature at all, or does\nnot allow enabling or disabling it.)\n\n--tpm2-device=PATH\nEnroll a TPM2 security chip. Expects a device node path referring to the TPM2 chip (e.g.\n/dev/tpmrm0). Alternatively the special value \"auto\" may be specified, in order to\nautomatically determine the device node of a currently discovered TPM2 device (of which\nthere must be exactly one). The special value \"list\" may be used to enumerate all\nsuitable TPM2 devices currently discovered.\n\nIn order to unlock a LUKS2 volume with an enrolled TPM2 security chip, specify the\ntpm2-device= option in the respective /etc/crypttab line:\n\nmyvolume /dev/sda1 - tpm2-device=auto\n\nSee crypttab(5) for a more comprehensive example of a systemd-cryptenroll invocation and\nits matching /etc/crypttab line.\n\nUse --tpm2-pcrs= (see below) to configure which TPM2 PCR indexes to bind the enrollment\nto.\n\n--tpm2-pcrs= [PCR...]\nConfigures the TPM2 PCRs (Platform Configuration Registers) to bind the enrollment\nrequested via --tpm2-device= to. Takes a \"+\" separated list of numeric PCR indexes in the\nrange 0...23. If not used, defaults to PCR 7 only. If an empty string is specified, binds\nthe enrollment to no PCRs at all. PCRs allow binding the enrollment to specific software\nversions and system state, so that the enrolled unlocking key is only accessible (may be\n\"unsealed\") if specific trusted software and/or configuration is used.\n\nTable 1. Well-known PCR Definitions\n┌────┬───────────────────────────────────┐\n│PCR │ Explanation                       │\n├────┼───────────────────────────────────┤\n│0   │ Core system firmware executable   │\n│    │ code; changes on firmware updates │\n├────┼───────────────────────────────────┤\n│1   │ Core system firmware data/host    │\n│    │ platform configuration; typically │\n│    │ contains serial and model         │\n│    │ numbers, changes on basic         │\n│    │ hardware/CPU/RAM replacements     │\n├────┼───────────────────────────────────┤\n│2   │ Extended or pluggable executable  │\n│    │ code; includes option ROMs on     │\n│    │ pluggable hardware                │\n├────┼───────────────────────────────────┤\n│3   │ Extended or pluggable firmware    │\n│    │ data; includes information about  │\n│    │ pluggable hardware                │\n├────┼───────────────────────────────────┤\n│4   │ Boot loader; changes on boot      │\n│    │ loader updates                    │\n├────┼───────────────────────────────────┤\n│5   │ GPT/Partition table; changes when │\n│    │ the partitions are added,         │\n│    │ modified or removed               │\n├────┼───────────────────────────────────┤\n│6   │ Power state events; changes on    │\n│    │ system suspend/sleep              │\n├────┼───────────────────────────────────┤\n│7   │ Secure boot state; changes when   │\n│    │ UEFI SecureBoot mode is           │\n│    │ enabled/disabled                  │\n├────┼───────────────────────────────────┤\n│8   │ sd-boot(7) measures the kernel    │\n│    │ command line in this PCR.         │\n└────┴───────────────────────────────────┘\n\n--wipe-slot= [SLOT...]\nWipes one or more LUKS2 key slots. Takes a comma separated list of numeric slot indexes,\nor the special strings \"all\" (for wiping all key slots), \"empty\" (for wiping all key\nslots that are unlocked by an empty passphrase), \"password\" (for wiping all key slots\nthat are unlocked by a traditional passphrase), \"recovery\" (for wiping all key slots that\nare unlocked by a recovery key), \"pkcs11\" (for wiping all key slots that are unlocked by\na PKCS#11 token), \"fido2\" (for wiping all key slots that are unlocked by a FIDO2 token),\n\"tpm2\" (for wiping all key slots that are unlocked by a TPM2 chip), or any combination of\nthese strings or numeric indexes, in which case all slots matching either are wiped. As\nsafety precaution an operation that wipes all slots without exception (so that the volume\ncannot be unlocked at all anymore, unless the volume key is known) is refused.\n\nThis switch may be used alone, in which case only the requested wipe operation is\nexecuted. It may also be used in combination with any of the enrollment options listed\nabove, in which case the enrollment is completed first, and only when successful the wipe\noperation executed — and the newly added slot is always excluded from the wiping.\nCombining enrollment and slot wiping may thus be used to update existing enrollments:\n\nsystemd-cryptenroll /dev/sda1 --wipe-slot=tpm2 --tpm2-device=auto\n\nThe above command will enroll the TPM2 chip, and then wipe all previously created TPM2\nenrollments on the LUKS2 volume, leaving only the newly created one. Combining wiping and\nenrollment may also be used to replace enrollments of different types, for example for\nchanging from a PKCS#11 enrollment to a FIDO2 one:\n\nsystemd-cryptenroll /dev/sda1 --wipe-slot=pkcs11 --fido2-device=auto\n\nOr for replacing an enrolled empty password by TPM2:\n\nsystemd-cryptenroll /dev/sda1 --wipe-slot=empty --tpm2-device=auto\n",
                    "long": "--recovery-key"
                },
                {
                    "name": "-h --help",
                    "content": "Print a short help text and exit.\n",
                    "flag": "-h",
                    "long": "--help"
                },
                {
                    "name": "--version",
                    "content": "Print a short version string and exit.\n",
                    "long": "--version"
                }
            ]
        },
        "EXIT STATUS": {
            "content": "On success, 0 is returned, a non-zero failure code otherwise.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "systemd(1), systemd-cryptsetup@.service(8), crypttab(5), cryptsetup(8)\n\n\n\nsystemd 249                                                                   SYSTEMD-CRYPTENROLL(1)",
            "subsections": []
        }
    },
    "summary": "systemd-cryptenroll - Enroll PKCS#11, FIDO2, TPM2 token/devices to LUKS2 encrypted volumes",
    "flags": [
        {
            "flag": "",
            "long": "--password",
            "arg": null,
            "description": "Enroll a regular password/passphrase. This command is mostly equivalent to cryptsetup luksAddKey, however may be combined with --wipe-slot= in one call, see below."
        },
        {
            "flag": "",
            "long": "--recovery-key",
            "arg": null,
            "description": "Enroll a recovery key. Recovery keys are most identical to passphrases, but are computer generated instead of human chosen, and thus have a guaranteed high entropy. The key uses a character set that is easy to type in, and may be scanned off screen via a QR code. --pkcs11-token-uri=URI Enroll a PKCS#11 security token or smartcard (e.g. a YubiKey). Expects a PKCS#11 smartcard URI referring to the token. Alternatively the special value \"auto\" may be specified, in order to automatically determine the URI of a currently plugged in security token (of which there must be exactly one). The special value \"list\" may be used to enumerate all suitable PKCS#11 tokens currently plugged in. The security token must contain an RSA key pair which is used to encrypt the randomly generated key that is used to unlock the LUKS2 volume. The encrypted key is then stored in the LUKS2 JSON token header area. In order to unlock a LUKS2 volume with an enrolled PKCS#11 security token, specify the pkcs11-uri= option in the respective /etc/crypttab line: myvolume /dev/sda1 - pkcs11-uri=auto See crypttab(5) for a more comprehensive example of a systemd-cryptenroll invocation and its matching /etc/crypttab line. --fido2-device=PATH Enroll a FIDO2 security token that implements the \"hmac-secret\" extension (e.g. a YubiKey). Expects a hidraw device referring to the FIDO2 device (e.g. /dev/hidraw1). Alternatively the special value \"auto\" may be specified, in order to automatically determine the device node of a currently plugged in security token (of which there must be exactly one). The special value \"list\" may be used to enumerate all suitable FIDO2 tokens currently plugged in. Note that many hardware security tokens that implement FIDO2 also implement the older PKCS#11 standard. Typically FIDO2 is preferable, given it's simpler to use and more modern. In order to unlock a LUKS2 volume with an enrolled FIDO2 security token, specify the fido2-device= option in the respective /etc/crypttab line: myvolume /dev/sda1 - fido2-device=auto See crypttab(5) for a more comprehensive example of a systemd-cryptenroll invocation and its matching /etc/crypttab line. --fido2-with-client-pin=BOOL When enrolling a FIDO2 security token, controls whether to require the user to enter a PIN when unlocking the volume (the FIDO2 \"clientPin\" feature). Defaults to \"yes\". (Note: this setting is without effect if the security token does not support the \"clientPin\" feature at all, or does not allow enabling or disabling it.) --fido2-with-user-presence=BOOL When enrolling a FIDO2 security token, controls whether to require the user to verify presence (tap the token, the FIDO2 \"up\" feature) when unlocking the volume. Defaults to \"yes\". (Note: this setting is without effect if the security token does not support the \"up\" feature at all, or does not allow enabling or disabling it.) --fido2-with-user-verification=BOOL When enrolling a FIDO2 security token, controls whether to require user verification when unlocking the volume (the FIDO2 \"uv\" feature). Defaults to \"no\". (Note: this setting is without effect if the security token does not support the \"uv\" feature at all, or does not allow enabling or disabling it.) --tpm2-device=PATH Enroll a TPM2 security chip. Expects a device node path referring to the TPM2 chip (e.g. /dev/tpmrm0). Alternatively the special value \"auto\" may be specified, in order to automatically determine the device node of a currently discovered TPM2 device (of which there must be exactly one). The special value \"list\" may be used to enumerate all suitable TPM2 devices currently discovered. In order to unlock a LUKS2 volume with an enrolled TPM2 security chip, specify the tpm2-device= option in the respective /etc/crypttab line: myvolume /dev/sda1 - tpm2-device=auto See crypttab(5) for a more comprehensive example of a systemd-cryptenroll invocation and its matching /etc/crypttab line. Use --tpm2-pcrs= (see below) to configure which TPM2 PCR indexes to bind the enrollment to. --tpm2-pcrs= [PCR...] Configures the TPM2 PCRs (Platform Configuration Registers) to bind the enrollment requested via --tpm2-device= to. Takes a \"+\" separated list of numeric PCR indexes in the range 0...23. If not used, defaults to PCR 7 only. If an empty string is specified, binds the enrollment to no PCRs at all. PCRs allow binding the enrollment to specific software versions and system state, so that the enrolled unlocking key is only accessible (may be \"unsealed\") if specific trusted software and/or configuration is used. Table 1. Well-known PCR Definitions ┌────┬───────────────────────────────────┐ │PCR │ Explanation │ ├────┼───────────────────────────────────┤ │0 │ Core system firmware executable │ │ │ code; changes on firmware updates │ ├────┼───────────────────────────────────┤ │1 │ Core system firmware data/host │ │ │ platform configuration; typically │ │ │ contains serial and model │ │ │ numbers, changes on basic │ │ │ hardware/CPU/RAM replacements │ ├────┼───────────────────────────────────┤ │2 │ Extended or pluggable executable │ │ │ code; includes option ROMs on │ │ │ pluggable hardware │ ├────┼───────────────────────────────────┤ │3 │ Extended or pluggable firmware │ │ │ data; includes information about │ │ │ pluggable hardware │ ├────┼───────────────────────────────────┤ │4 │ Boot loader; changes on boot │ │ │ loader updates │ ├────┼───────────────────────────────────┤ │5 │ GPT/Partition table; changes when │ │ │ the partitions are added, │ │ │ modified or removed │ ├────┼───────────────────────────────────┤ │6 │ Power state events; changes on │ │ │ system suspend/sleep │ ├────┼───────────────────────────────────┤ │7 │ Secure boot state; changes when │ │ │ UEFI SecureBoot mode is │ │ │ enabled/disabled │ ├────┼───────────────────────────────────┤ │8 │ sd-boot(7) measures the kernel │ │ │ command line in this PCR. │ └────┴───────────────────────────────────┘ --wipe-slot= [SLOT...] Wipes one or more LUKS2 key slots. Takes a comma separated list of numeric slot indexes, or the special strings \"all\" (for wiping all key slots), \"empty\" (for wiping all key slots that are unlocked by an empty passphrase), \"password\" (for wiping all key slots that are unlocked by a traditional passphrase), \"recovery\" (for wiping all key slots that are unlocked by a recovery key), \"pkcs11\" (for wiping all key slots that are unlocked by a PKCS#11 token), \"fido2\" (for wiping all key slots that are unlocked by a FIDO2 token), \"tpm2\" (for wiping all key slots that are unlocked by a TPM2 chip), or any combination of these strings or numeric indexes, in which case all slots matching either are wiped. As safety precaution an operation that wipes all slots without exception (so that the volume cannot be unlocked at all anymore, unless the volume key is known) is refused. This switch may be used alone, in which case only the requested wipe operation is executed. It may also be used in combination with any of the enrollment options listed above, in which case the enrollment is completed first, and only when successful the wipe operation executed — and the newly added slot is always excluded from the wiping. Combining enrollment and slot wiping may thus be used to update existing enrollments: systemd-cryptenroll /dev/sda1 --wipe-slot=tpm2 --tpm2-device=auto The above command will enroll the TPM2 chip, and then wipe all previously created TPM2 enrollments on the LUKS2 volume, leaving only the newly created one. Combining wiping and enrollment may also be used to replace enrollments of different types, for example for changing from a PKCS#11 enrollment to a FIDO2 one: systemd-cryptenroll /dev/sda1 --wipe-slot=pkcs11 --fido2-device=auto Or for replacing an enrolled empty password by TPM2: systemd-cryptenroll /dev/sda1 --wipe-slot=empty --tpm2-device=auto"
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "Print a short help text and exit."
        },
        {
            "flag": "",
            "long": "--version",
            "arg": null,
            "description": "Print a short version string and exit."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "systemd",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/systemd/1/json"
        },
        {
            "name": ".service",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/.service/8/json"
        },
        {
            "name": "crypttab",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/crypttab/5/json"
        },
        {
            "name": "cryptsetup",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/cryptsetup/8/json"
        },
        {
            "name": "SYSTEMD-CRYPTENROLL",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/SYSTEMD-CRYPTENROLL/1/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Interactively enroll or remove methods used to unlock LUKS2-encrypted devices. Uses a password to unlock the device unless otherwise specified.",
        "examples": [
            {
                "description": "Enroll a new password (similar to `cryptsetup luksAddKey`)",
                "command": "systemd-cryptenroll --password {{path/to/luks2_block_device}}"
            },
            {
                "description": "Enroll a new recovery key (i.e. a randomly generated passphrase that can be used as a fallback)",
                "command": "systemd-cryptenroll --recovery-key {{path/to/luks2_block_device}}"
            },
            {
                "description": "List available tokens, or enroll a new PKCS#11 token",
                "command": "systemd-cryptenroll --pkcs11-token-uri {{list|auto|pkcs11_token_uri}} {{path/to/luks2_block_device}}"
            },
            {
                "description": "List available FIDO2 devices, or enroll a new FIDO2 device (`auto` can be used as the device name when there is only one token plugged in)",
                "command": "systemd-cryptenroll --fido2-device {{list|auto|path/to/fido2_hidraw_device}} {{path/to/luks2_block_device}}"
            },
            {
                "description": "Enroll a new FIDO2 device with user verification (biometrics)",
                "command": "systemd-cryptenroll --fido2-device {{auto|path/to/fido2_hidraw_device}} --fido2-with-user-verification yes {{path/to/luks2_block_device}}"
            },
            {
                "description": "Unlock using a FIDO2 device, and enroll a new FIDO2 device",
                "command": "systemd-cryptenroll --unlock-fido2-device {{path/to/fido2_hidraw_unlock_device}} --fido2-device {{path/to/fido2_hidraw_enroll_device}} {{path/to/luks2_block_device}}"
            },
            {
                "description": "Enroll a TPM2 security chip (only secure-boot-policy PCR) and require an additional alphanumeric PIN",
                "command": "systemd-cryptenroll --tpm2-device {{auto|path/to/tpm2_block_device}} --tpm2-with-pin yes {{path/to/luks2_block_device}}"
            },
            {
                "description": "Remove all empty passwords/all passwords/all FIDO2 devices/all PKCS#11 tokens/all TPM2 security chips/all recovery keys/all methods",
                "command": "systemd-cryptenroll --wipe-slot {{empty|password|fido2|pkcs#11|tpm2|recovery|all}} {{path/to/luks2_block_device}}"
            }
        ]
    }
}