1CRYPTSETUP-LUKSADDKEY(8)     Maintenance Commands     CRYPTSETUP-LUKSADDKEY(8)
2
3
4

NAME

6       cryptsetup-luksAddKey - add a new passphrase
7

SYNOPSIS

9       cryptsetup luksAddKey [<options>] <device> [<key file with new key>]
10

DESCRIPTION

12       Adds a new passphrase. An existing passphrase must be supplied
13       interactively or via --key-file. The new passphrase to be added can be
14       specified interactively or read from the file given as the positional
15       argument.
16
17       NOTE: with --unbound option the action creates new unbound LUKS2
18       keyslot. The keyslot cannot be used for device activation. If you don’t
19       pass new key via --volume-key-file option, new random key is generated.
20       Existing passphrase for any active keyslot is not required.
21
22       NOTE: some parameters are effective only if used with LUKS2 format that
23       supports per-keyslot parameters. For LUKS1, PBKDF type and hash
24       algorithm is always the same for all keyslots.
25
26       <options> can be [--key-file, --keyfile-offset, --keyfile-size,
27       --new-keyfile-offset, --new-keyfile-size, --key-slot,
28       --volume-key-file, --force-password, --hash, --header, --disable-locks,
29       --iter-time, --pbkdf, --pbkdf-force-iterations, --pbkdf-memory,
30       --pbkdf-parallel, --unbound, --type, --keyslot-cipher,
31       --keyslot-key-size, --key-size, --timeout, --verify-passphrase].
32

OPTIONS

34       --type <device-type>
35           Specifies required device type, for more info read BASIC ACTIONS
36           section in cryptsetup(8).
37
38       --hash, -h <hash-spec>
39           The specified hash is used for PBKDF2 and AF splitter.
40
41       --verify-passphrase, -y
42           When interactively asking for a passphrase, ask for it twice and
43           complain if both inputs do not match. Ignored on input from file or
44           stdin.
45
46       --key-file, -d name
47           Read the passphrase from file.
48
49           If the name given is "-", then the passphrase will be read from
50           stdin. In this case, reading will not stop at newline characters.
51
52           With LUKS, the passphrase supplied via --key-file is always the
53           existing passphrase requested by a command, except in the case of
54           luksFormat where --key-file is equivalent to the positional key
55           file argument.
56
57           If you want to set a new passphrase via key file, you have to use a
58           positional argument to luksAddKey.
59
60           See section NOTES ON PASSPHRASE PROCESSING in cryptsetup(8) for
61           more information.
62
63       --keyfile-offset value
64           Skip value bytes at the beginning of the key file.
65
66       --keyfile-size, -l value
67           Read a maximum of value bytes from the key file. The default is to
68           read the whole file up to the compiled-in maximum that can be
69           queried with --help. Supplying more data than the compiled-in
70           maximum aborts the operation.
71
72           This option is useful to cut trailing newlines, for example. If
73           --keyfile-offset is also given, the size count starts after the
74           offset.
75
76       --new-keyfile-offset value
77           Skip value bytes at the start when adding a new passphrase from key
78           file with luksAddKey.
79
80       --new-keyfile-size value
81           Read a maximum of value bytes when adding a new passphrase from key
82           file with luksAddKey. The default is to read the whole file up to
83           the compiled-in maximum length that can be queried with --help.
84           Supplying more than the compiled in maximum aborts the operation.
85           When --new-keyfile-offset is also given, reading starts after the
86           offset.
87
88       --volume-key-file, --master-key-file (OBSOLETE alias)
89           Use a volume key stored in a file. For luksAddKey this allows
90           adding a new passphrase without having to know an existing one.
91           WARNING: If you create your own volume key, you need to make sure
92           to do it right. Otherwise, you can end up with a low-entropy or
93           otherwise partially predictable volume key which will compromise
94           security.
95
96       --key-slot, -S <0-N>
97           For LUKS operations that add key material, this option allows you
98           to specify which key slot is selected for the new key.
99
100           The maximum number of key slots depends on the LUKS version. LUKS1
101           can have up to 8 key slots. LUKS2 can have up to 32 key slots based
102           on key slot area size and key size, but a valid key slot ID can
103           always be between 0 and 31 for LUKS2.
104
105       --key-size, -s bits
106           Sets key size in bits. The argument has to be a multiple of 8. The
107           possible key-sizes are limited by the cipher and mode used.
108
109           See /proc/crypto for more information. Note that key-size in
110           /proc/crypto is stated in bytes.
111
112           This option can be used for open --type plain or luksFormat. All
113           other LUKS actions will use the key-size specified in the LUKS
114           header. Use cryptsetup --help to show the compiled-in defaults.
115
116       --pbkdf <PBKDF spec>
117           Set Password-Based Key Derivation Function (PBKDF) algorithm for
118           LUKS keyslot. The PBKDF can be: pbkdf2 (for PBKDF2 according to
119           RFC2898), argon2i for Argon2i or argon2id for Argon2id (see Argon2
120           <https://www.cryptolux.org/index.php/Argon2> for more info).
121
122           For LUKS1, only PBKDF2 is accepted (no need to use this option).
123           The default PBKDF for LUKS2 is set during compilation time and is
124           available in cryptsetup --help output.
125
126           A PBKDF is used for increasing dictionary and brute-force attack
127           cost for keyslot passwords. The parameters can be time, memory and
128           parallel cost.
129
130           For PBKDF2, only time cost (number of iterations) applies. For
131           Argon2i/id, there is also memory cost (memory required during the
132           process of key derivation) and parallel cost (number of threads
133           that run in parallel during the key derivation.
134
135           Note that increasing memory cost also increases time, so the final
136           parameter values are measured by a benchmark. The benchmark tries
137           to find iteration time (--iter-time) with required memory cost
138           --pbkdf-memory. If it is not possible, the memory cost is decreased
139           as well. The parallel cost --pbkdf-parallel is constant and is
140           checked against available CPU cores.
141
142           You can see all PBKDF parameters for particular LUKS2 keyslot with
143           cryptsetup-luksDump(8) command.
144
145           NOTE: If you do not want to use benchmark and want to specify all
146           parameters directly, use --pbkdf-force-iterations with
147           --pbkdf-memory and --pbkdf-parallel. This will override the values
148           without benchmarking. Note it can cause extremely long unlocking
149           time. Use only in specific cases, for example, if you know that the
150           formatted device will be used on some small embedded system.
151
152           MINIMAL AND MAXIMAL PBKDF COSTS: For PBKDF2, the minimum iteration
153           count is 1000 and maximum is 4294967295 (maximum for 32bit unsigned
154           integer). Memory and parallel costs are unused for PBKDF2. For
155           Argon2i and Argon2id, minimum iteration count (CPU cost) is 4 and
156           maximum is 4294967295 (maximum for 32bit unsigned integer). Minimum
157           memory cost is 32 KiB and maximum is 4 GiB. (Limited by addressable
158           memory on some CPU platforms.) If the memory cost parameter is
159           benchmarked (not specified by a parameter) it is always in range
160           from 64 MiB to 1 GiB. The parallel cost minimum is 1 and maximum 4
161           (if enough CPUs cores are available, otherwise it is decreased).
162
163       --iter-time, -i <number of milliseconds>
164           The number of milliseconds to spend with PBKDF passphrase
165           processing. Specifying 0 as parameter selects the compiled-in
166           default.
167
168       --pbkdf-memory <number>
169           Set the memory cost for PBKDF (for Argon2i/id the number represents
170           kilobytes). Note that it is maximal value, PBKDF benchmark or
171           available physical memory can decrease it. This option is not
172           available for PBKDF2.
173
174       --pbkdf-parallel <number>
175           Set the parallel cost for PBKDF (number of threads, up to 4). Note
176           that it is maximal value, it is decreased automatically if CPU
177           online count is lower. This option is not available for PBKDF2.
178
179       --pbkdf-force-iterations <num>
180           Avoid PBKDF benchmark and set time cost (iterations) directly. It
181           can be used for LUKS/LUKS2 device only. See --pbkdf option for more
182           info.
183
184       --timeout, -t <number of seconds>
185           The number of seconds to wait before timeout on passphrase input
186           via terminal. It is relevant every time a passphrase is asked. It
187           has no effect if used in conjunction with --key-file.
188
189           This option is useful when the system should not stall if the user
190           does not input a passphrase, e.g. during boot. The default is a
191           value of 0 seconds, which means to wait forever.
192
193       --header <device or file storing the LUKS header>
194           Use a detached (separated) metadata device or file where the LUKS
195           header is stored. This option allows one to store ciphertext and
196           LUKS header on different devices.
197
198           For commands that change the LUKS header (e.g. luksAddKey), specify
199           the device or file with the LUKS header directly as the LUKS
200           device.
201
202       --force-password
203           Do not use password quality checking for new LUKS passwords.
204
205           This option is ignored if cryptsetup is built without password
206           quality checking support.
207
208           For more info about password quality check, see the manual page for
209           pwquality.conf(5) and passwdqc.conf(5).
210
211       --disable-locks
212           Disable lock protection for metadata on disk. This option is valid
213           only for LUKS2 and ignored for other formats.
214
215           WARNING: Do not use this option unless you run cryptsetup in a
216           restricted environment where locking is impossible to perform
217           (where /run directory cannot be used).
218
219       --keyslot-cipher <cipher-spec>
220           This option can be used to set specific cipher encryption for the
221           LUKS2 keyslot area.
222
223       --keyslot-key-size <bits>
224           This option can be used to set specific key size for the LUKS2
225           keyslot area.
226
227       --unbound
228           Creates new or dumps existing LUKS2 unbound keyslot.
229
230       --batch-mode, -q
231           Suppresses all confirmation questions. Use with care!
232
233           If the --verify-passphrase option is not specified, this option
234           also switches off the passphrase verification.
235
236       --debug or --debug-json
237           Run in debug mode with full diagnostic logs. Debug output lines are
238           always prefixed by #.
239
240           If --debug-json is used, additional LUKS2 JSON data structures are
241           printed.
242
243       --version, -V
244           Show the program version.
245
246       --usage
247           Show short option help.
248
249       --help, -?
250           Show help text and default parameters.
251

REPORTING BUGS

253       Report bugs at cryptsetup mailing list <cryptsetup@lists.linux.dev> or
254       in Issues project section
255       <https://gitlab.com/cryptsetup/cryptsetup/-/issues/new>.
256
257       Please attach output of the failed command with --debug option added.
258

SEE ALSO

260       Cryptsetup FAQ
261       <https://gitlab.com/cryptsetup/cryptsetup/wikis/FrequentlyAskedQuestions>
262
263       cryptsetup(8), integritysetup(8) and veritysetup(8)
264

CRYPTSETUP

266       Part of cryptsetup project <https://gitlab.com/cryptsetup/cryptsetup/>.
267
268
269
270cryptsetup 2.5.0                  2022-07-28          CRYPTSETUP-LUKSADDKEY(8)
Impressum