1# SPDX-License-Identifier: CC0-1.0
2
3# Enroll the TPM2 security chip in the LUKS2 volume, and bind it to PCR 7
4# only. Replace /dev/sdXn by the partition to use (e.g. /dev/sda1).
5sudo systemd-cryptenroll --tpm2-device=auto --tpm2-pcrs=7 /dev/sdXn
6
7# Test: Let's run systemd-cryptsetup to test if this worked.
8sudo /usr/lib/systemd/systemd-cryptsetup attach mytest /dev/sdXn - tpm2-device=auto
9
10# If that worked, let's now add the same line persistently to /etc/crypttab,
11# for the future.
12sudo bash -c 'echo "mytest /dev/sdXn - tpm2-device=auto" >> /etc/crypttab'
13