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