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