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

NAME

6       cryptsetup - manage plain dm-crypt and LUKS encrypted volumes
7

SYNOPSIS

9       cryptsetup <options> <action> <action args>
10

DESCRIPTION

12       cryptsetup is used to conveniently setup dm-crypt managed device-mapper
13       mappings. These include plain dm-crypt volumes and  LUKS  volumes.  The
14       difference is that LUKS uses a metadata header and can hence offer more
15       features than plain dm-crypt. On the other hand, the header is  visible
16       and vulnerable to damage.
17
18       In  addition,  cryptsetup provides limited support for the use of loop-
19       AES volumes and for TrueCrypt compatible volumes.
20
21

PLAIN DM-CRYPT OR LUKS?

23       Unless you understand the  cryptographic  background  well,  use  LUKS.
24       With  plain  dm-crypt  there  are a number of possible user errors that
25       massively decrease security. While LUKS cannot fix  them  all,  it  can
26       lessen the impact for many of them.
27

WARNINGS

29       A  lot  of good information on the risks of using encrypted storage, on
30       handling problems and on security aspects can be found  in  the  Crypt‐
31       setup  FAQ.  Read  it.  Nonetheless, some risks deserve to be mentioned
32       here.
33
34       Backup: Storage media die. Encryption has no influence on that.  Backup
35       is mandatory for encrypted data as well, if the data has any worth. See
36       the Cryptsetup FAQ for advice on how to do a  backup  of  an  encrypted
37       volume.
38
39       Character encoding: If you enter a passphrase with special symbols, the
40       passphrase can change depending on character  encoding.  Keyboard  set‐
41       tings  can  also change, which can make blind input hard or impossible.
42       For example, switching from some ASCII 8-bit variant to UTF-8 can  lead
43       to  a  different binary encoding and hence different passphrase seen by
44       cryptsetup, even if what you see on the terminal is exactly  the  same.
45       It is therefore highly recommended to select passphrase characters only
46       from 7-bit ASCII, as the encoding for 7-bit ASCII stays  the  same  for
47       all ASCII variants and UTF-8.
48
49       LUKS  header:  If the header of a LUKS volume gets damaged, all data is
50       permanently lost unless you have a header-backup.   If  a  key-slot  is
51       damaged,  it  can  only  be restored from a header-backup or if another
52       active key-slot with known passphrase is undamaged.  Damaging the  LUKS
53       header is something people manage to do with surprising frequency. This
54       risk is the result of a trade-off between security and safety, as  LUKS
55       is  designed  for fast and secure wiping by just overwriting header and
56       key-slot area.
57
58       Previously used partitions: If a partition was previously used, it is a
59       very  good idea to wipe filesystem signatures, data, etc. before creat‐
60       ing a LUKS or plain dm-crypt container on it.  For a quick  removal  of
61       filesystem signatures, use "wipefs". Take care though that this may not
62       remove everything. In particular, MD RAID signatures at the  end  of  a
63       device  may  survive.  It  also  does not remove data. For a full wipe,
64       overwrite the whole partition before container creation. If you do  not
65       know how to do that, the cryptsetup FAQ describes several options.
66
67

BASIC COMMANDS

69       The following are valid actions for all supported device types.
70
71       open <device> <name> --type <device_type>
72
73              Opens (creates a mapping with) <name> backed by device <device>.
74
75              Device  type can be plain, luks (default), luks1, luks2, loopaes
76              or tcrypt.
77
78              For backward compatibility there are open command aliases:
79
80              create (argument-order <name> <device>): open --type plain
81              plainOpen: open --type plain
82              luksOpen: open --type luks
83              loopaesOpen: open --type loopaes
84              tcryptOpen: open --type tcrypt
85
86              <options> are type specific and are described below for individ‐
87              ual  device  types.  For  create,  the  order  of the <name> and
88              <device> options is inverted for historical reasons,  all  other
89              aliases use the standard <device> <name> order.
90
91       close <name>
92
93              Removes  the existing mapping <name> and wipes the key from ker‐
94              nel memory.
95
96              For backward compatibility  there  are  close  command  aliases:
97              remove,  plainClose,  luksClose,  loopaesClose, tcryptClose (all
98              behaves exactly the same, device type  is  determined  automati‐
99              cally from active device).
100
101              <options> can be [--deferred]
102
103
104       status <name>
105
106              Reports the status for the mapping <name>.
107
108       resize <name>
109
110              Resizes an active mapping <name>.
111
112              If  --size  (in 512-bytes sectors) is not specified, the size is
113              computed from the underlying device. For LUKS it is the size  of
114              the  underlying device without the area reserved for LUKS header
115              (see data payload offset in luksDump command).  For plain  crypt
116              device, the whole device size is used.
117
118              Note  that this does not change the raw device geometry, it just
119              changes how many sectors of the raw device  are  represented  in
120              the mapped device.
121
122              If  cryptsetup  detected  volume key for active device loaded in
123              kernel  keyring  service,  resize  action  would  first  try  to
124              retrieve  the  key  using a token and only if it failed it'd ask
125              for a passphrase to unlock a keyslot (LUKS) or to derive a  vol‐
126              ume  key  again  (plain  mode).   The  kernel keyring is used by
127              default for LUKS2 devices.
128
129              With LUKS2  device  additional  <options>  can  be  [--token-id,
130              --token-only,  --key-slot,  --key-file,  --keyfile-size,  --key‐
131              file-offset, --timeout, --disable-locks, --disable-keyring].
132
133

PLAIN MODE

135       Plain dm-crypt encrypts the device sector-by-sector with a single, non-
136       salted  hash of the passphrase. No checks are performed, no metadata is
137       used. There is no formatting operation.  When the raw device is  mapped
138       (opened), the usual device operations can be used on the mapped device,
139       including  filesystem  creation.   Mapped  devices  usually  reside  in
140       /dev/mapper/<name>.
141
142       The following are valid plain device type actions:
143
144       open --type plain <device> <name>
145       create <name> <device> (OBSOLETE syntax)
146
147              Opens (creates a mapping with) <name> backed by device <device>.
148
149              <options>  can be [--hash, --cipher, --verify-passphrase, --sec‐
150              tor-size, --key-file,  --keyfile-offset,  --key-size,  --offset,
151              --skip, --size, --readonly, --shared, --allow-discards]
152
153              Example:  'cryptsetup  open --type plain /dev/sda10 e1' maps the
154              raw encrypted device /dev/sda10 to the mapped (decrypted) device
155              /dev/mapper/e1,  which  can  then  be mounted, fsck-ed or have a
156              filesystem created on it.
157

LUKS EXTENSION

159       LUKS, the Linux Unified Key Setup, is a standard for  disk  encryption.
160       It  adds  a  standardized header at the start of the device, a key-slot
161       area directly behind the header and the bulk data area behind that. The
162       whole  set  is  called a 'LUKS container'.  The device that a LUKS con‐
163       tainer resides on is called a 'LUKS device'.  For most  purposes,  both
164       terms  can  be used interchangeably. But note that when the LUKS header
165       is at a nonzero offset in a device, then  the  device  is  not  a  LUKS
166       device anymore, but has a LUKS container stored in it at an offset.
167
168       LUKS  can  manage multiple passphrases that can be individually revoked
169       or changed and that can be securely scrubbed from persistent media  due
170       to  the use of anti-forensic stripes. Passphrases are protected against
171       brute-force and dictionary attacks by  PBKDF2,  which  implements  hash
172       iteration and salting in one function.
173
174       LUKS2  is  a new version of header format that allows additional exten‐
175       sions like different PBKDF algorithm or authenticated encryption.   You
176       can  format  device  with  LUKS2  header if you specify --type luks2 in
177       luksFormat command.  For activation, the format is  already  recognized
178       automatically.
179
180       Each passphrase, also called a key in this document, is associated with
181       one of 8 key-slots.  Key operations that do not specify a  slot  affect
182       the  first slot that matches the supplied passphrase or the first empty
183       slot if a new passphrase is added.
184
185       The <device> parameter can also be specified by a LUKS UUID in the for‐
186       mat  UUID=<uuid>.  Translation  to  real  device  name uses symlinks in
187       /dev/disk/by-uuid directory.
188
189       To specify a detached header, the --header parameter can be used in all
190       LUKS  commands and always takes precedence over the positional <device>
191       parameter.
192
193       The following are valid LUKS actions:
194
195       luksFormat <device> [<key file>]
196
197              Initializes a LUKS partition and  sets  the  initial  passphrase
198              (for  key-slot  0), either via prompting or via <key file>. Note
199              that if the second argument is present, then the  passphrase  is
200              taken  from  the  file  given there, without the need to use the
201              --key-file option. Also note that for both forms of reading  the
202              passphrase  from  a  file  you  can give '-' as file name, which
203              results in the passphrase being read from stdin and the  safety-
204              question being skipped.
205
206              You  can  only  call  luksFormat  on  a  LUKS device that is not
207              mapped.
208
209              To use LUKS2, specify --type luks2.
210
211              <options>  can  be   [--hash,   --cipher,   --verify-passphrase,
212              --key-size,   --key-slot,   --key-file  (takes  precedence  over
213              optional  second  argument),  --keyfile-offset,  --keyfile-size,
214              --use-random   |   --use-urandom,   --uuid,   --master-key-file,
215              --iter-time, --header,  --pbkdf-force-iterations,  --force-pass‐
216              word, --disable-locks].
217
218              For   LUKS2,   additional   <options>   can   be   [--integrity,
219              --integrity-no-wipe,   --sector-size,   --label,    --subsystem,
220              --pbkdf,   --pbkdf-memory,   --pbkdf-parallel,  --disable-locks,
221              --disable-keyring].
222
223              WARNING: Doing a luksFormat on an existing LUKS  container  will
224              make all data the old container permanently irretrievable unless
225              you have a header backup.
226
227       open --type luks <device> <name>
228       luksOpen <device> <name> (old syntax)
229
230              Opens the LUKS device <device> and  sets  up  a  mapping  <name>
231              after successful verification of the supplied passphrase.
232
233              First,  the  passphrase  is searched in LUKS tokens. If it's not
234              found in any token and also the passphrase is not  supplied  via
235              --key-file, the command prompts for it interactively.
236
237              <options>  can be [--key-file, --keyfile-offset, --keyfile-size,
238              --readonly,   --test-passphrase,   --allow-discards,   --header,
239              --key-slot,  --master-key-file, --token-id, --token-only, --dis‐
240              able-keyring, --disable-locks, --type].
241
242       luksSuspend <name>
243
244              Suspends an active device (all  IO  operations  will  block  and
245              accesses  to  the  device  will wait indefinitely) and wipes the
246              encryption key from kernel memory. Needs kernel 2.6.19 or later.
247
248              After this operation you have to use luksResume to reinstate the
249              encryption  key  and  unblock  the device or close to remove the
250              mapped device.
251
252              WARNING: never suspend the device on which the cryptsetup binary
253              resides.
254
255              <options> can be [--header, --disable-locks].
256
257       luksResume <name>
258
259              Resumes  a  suspended  device and reinstates the encryption key.
260              Prompts interactively for a  passphrase  if  --key-file  is  not
261              given.
262
263              <options>  can  be [--key-file, --keyfile-size, --header, --dis‐
264              able-keyring, --disable-locks, --type]
265
266       luksAddKey <device> [<key file with new key>]
267
268              Adds a new passphrase. An existing passphrase must  be  supplied
269              interactively or via --key-file.  The new passphrase to be added
270              can be specified interactively or read from the  file  given  as
271              positional argument.
272
273              NOTE: with --unbound option the action creates new unbound LUKS2
274              keyslot. The keyslot cannot be used for device  activation.   If
275              you  don't pass new key via --master-key-file option, new random
276              key is generated. Existing passphrase for any active keyslot  is
277              not required.
278
279              <options>  can be [--key-file, --keyfile-offset, --keyfile-size,
280              --new-keyfile-offset,  --new-keyfile-size,  --key-slot,   --mas‐
281              ter-key-file,  --iter-time,  --force-password,  --header, --dis‐
282              able-locks, --unbound, --type].
283
284       luksRemoveKey <device> [<key file with passphrase to be removed>]
285
286              Removes the  supplied  passphrase  from  the  LUKS  device.  The
287              passphrase  to be removed can be specified interactively, as the
288              positional argument or via --key-file.
289
290              <options> can be [--key-file, --keyfile-offset,  --keyfile-size,
291              --header, --disable-locks, --type]
292
293              WARNING:  If you read the passphrase from stdin (without further
294              argument or with '-' as an argument to  --key-file),  batch-mode
295              (-q) will be implicitly switched on and no warning will be given
296              when you remove the last remaining passphrase from a  LUKS  con‐
297              tainer.  Removing  the  last passphrase makes the LUKS container
298              permanently inaccessible.
299
300       luksChangeKey <device> [<new key file>]
301
302              Changes an existing passphrase. The  passphrase  to  be  changed
303              must  be  supplied  interactively  or  via  --key-file.  The new
304              passphrase can be supplied interactively or in a file  given  as
305              positional argument.
306
307              If  a key-slot is specified (via --key-slot), the passphrase for
308              that key-slot must be given and the new  passphrase  will  over‐
309              write  the  specified  key-slot. If no key-slot is specified and
310              there is still a free key-slot, then the new passphrase will  be
311              put  into a free key-slot before the key-slot containing the old
312              passphrase is purged. If there is no  free  key-slot,  then  the
313              key-slot with the old passphrase is overwritten directly.
314
315              WARNING:  If  a  key-slot is overwritten, a media failure during
316              this operation can cause the overwrite to  fail  after  the  old
317              passphrase has been wiped and make the LUKS container inaccessi‐
318              ble.
319
320              <options> can be [--key-file, --keyfile-offset,  --keyfile-size,
321              --new-keyfile-offset,       --new-keyfile-size,      --key-slot,
322              --force-password, --header, --disable-locks, --type].
323
324       luksConvertKey <device>
325
326              Converts an existing LUKS2 keyslot to new pbkdf parameters.  The
327              passphrase for keyslot to be converted must be supplied interac‐
328              tively or via --key-file. If no --pbkdf parameters are specified
329              LUKS2 default pbkdf values will apply.
330
331              If  a  keyslot is specified (via --key-slot), the passphrase for
332              that keyslot must be given. If no keyslot is specified and there
333              is  still  a  free  keyslot, then the new parameters will be put
334              into a free keyslot before the keyslot containing the old param‐
335              eters  is  purged. If there is no free keyslot, then the keyslot
336              with the old parameters is overwritten directly.
337
338              WARNING: If a keyslot is overwritten,  a  media  failure  during
339              this  operation  can  cause  the overwrite to fail after the old
340              parameters have been wiped and make the LUKS container  inacces‐
341              sible.
342
343              <options>  can be [--key-file, --keyfile-offset, --keyfile-size,
344              --key-slot,  --header,  --disable-locks,  --iter-time,  --pbkdf,
345              --pbkdf-force-iterations, --pbkdf-memory, --pbkdf-parallel].
346
347       luksKillSlot <device> <key slot number>
348
349              Wipe the key-slot number <key slot> from the LUKS device. Except
350              running in batch-mode (-q) a remaining passphrase must  be  sup‐
351              plied, either interactively or via --key-file.  This command can
352              remove the last remaining key-slot, but requires an  interactive
353              confirmation when doing so. Removing the last passphrase makes a
354              LUKS container permanently inaccessible.
355
356              <options> can be [--key-file, --keyfile-offset,  --keyfile-size,
357              --header, --disable-locks, --type].
358
359              WARNING:  If you read the passphrase from stdin (without further
360              argument or with '-' as an argument to  --key-file),  batch-mode
361              (-q) will be implicitly switched on and no warning will be given
362              when you remove the last remaining passphrase from a  LUKS  con‐
363              tainer.  Removing  the  last passphrase makes the LUKS container
364              permanently inaccessible.
365
366              NOTE: If there is no passphrase provided (on  stdin  or  through
367              --key-file argument) and batch-mode (-q) is active, the key-slot
368              is removed without any other warning.
369
370
371       erase <device>
372       luksErase <device>
373
374              Erase all keyslots and make the LUKS container permanently inac‐
375              cessible.   You  do  not  need  to provide any password for this
376              operation.
377
378              WARNING: This operation is irreversible.
379
380       luksUUID <device>
381
382              Print the UUID of a LUKS device.
383              Set new UUID if --uuid option is specified.
384
385       isLuks <device>
386
387              Returns true, if <device> is a  LUKS  device,  false  otherwise.
388              Use  option -v to get human-readable feedback. 'Command success‐
389              ful.'  means the device is a LUKS device.
390
391              By specifying --type you may query for specific LUKS version.
392
393       luksDump <device>
394
395              Dump the header information of a LUKS device.
396
397              If the --dump-master-key option is used, the LUKS device  master
398              key  is dumped instead of the keyslot info. Together with --mas‐
399              ter-key-file option, master key is dumped to a file  instead  of
400              standard  output.  Beware  that the master key cannot be changed
401              without reencryption and can be used to decrypt the data  stored
402              in  the LUKS container without a passphrase and even without the
403              LUKS header. This means that if the master key  is  compromised,
404              the whole device has to be erased to prevent further access. Use
405              this option carefully.
406
407              To dump the master key, a passphrase has to be supplied,  either
408              interactively or via --key-file.
409
410              <options>  can be [--dump-master-key, --key-file, --keyfile-off‐
411              set,   --keyfile-size,   --header,    --disable-locks,    --mas‐
412              ter-key-file, --type].
413
414              WARNING:  If  --dump-master-key  is used with --key-file and the
415              argument to --key-file is '-', no validation  question  will  be
416              asked and no warning given.
417
418       luksHeaderBackup <device> --header-backup-file <file>
419
420              Stores a binary backup of the LUKS header and keyslot area.
421              Note:  Using  '-' as filename writes the header backup to a file
422              named '-'.
423
424              WARNING: This backup file and a passphrase valid at the time  of
425              backup  allows  decryption  of  the  LUKS data area, even if the
426              passphrase was later changed or removed from  the  LUKS  device.
427              Also  note  that  with  a  header backup you lose the ability to
428              securely wipe the LUKS device by just overwriting the header and
429              key-slots.  You either need to securely erase all header backups
430              in addition or overwrite the encrypted data area as  well.   The
431              second  option is less secure, as some sectors can survive, e.g.
432              due to defect management.
433
434       luksHeaderRestore <device> --header-backup-file <file>
435
436              Restores a binary backup of the LUKS  header  and  keyslot  area
437              from the specified file.
438              Note:  Using '-' as filename reads the header backup from a file
439              named '-'.
440
441              WARNING:  Header  and  keyslots  will  be  replaced,  only   the
442              passphrases from the backup will work afterward.
443
444              This  command  requires that the master key size and data offset
445              of the LUKS header already on  the  device  and  of  the  header
446              backup  match.  Alternatively, if there is no LUKS header on the
447              device, the backup will also be written to it.
448
449       token <add|remove|import|export> <device>
450
451              Action add creates new keyring token to  enable  auto-activation
452              of  the device.  For the auto-activation, the passphrase must be
453              stored in keyring with the specified description.  Usually,  the
454              passphrase  should  be  stored  in user or user-session keyring.
455              The token command is supported only for LUKS2.
456
457              For adding new keyring token, option --key-description is manda‐
458              tory.   Also,  new  token is assigned to key slot specified with
459              --key-slot option or  to  all  active  key  slots  in  the  case
460              --key-slot option is omitted.
461
462              To  remove  existing token, specify the token ID which should be
463              removed with --token-id option.
464
465              WARNING: The action token remove removes  any  token  type,  not
466              just  keyring  type  from  token  slot  specified  by --token-id
467              option.
468
469              Action import can store arbitrary  valid  token  json  in  LUKS2
470              header.  It  may be passed via standard input or via file passed
471              in --json-file option. If you specify --key-slot  then  success‐
472              fully imported token is also assigned to the key slot.
473
474              Action  export writes requested token json to a file passed with
475              --json-file or to standard output.
476
477              <options>   can   be    [--header,    --token-id,    --key-slot,
478              --key-description,      --disable-locks,      --disable-keyring,
479              --json-file].
480
481       convert <device> --type <format>
482
483              Converts the device between LUKS1 and LUKS2  format  (if  possi‐
484              ble).  The conversion will not be performed if there is an addi‐
485              tional LUKS2 feature or LUKS1 has unsupported header size.
486
487              Conversion (both  directions)  must  be  performed  on  inactive
488              device.  There  must  not be active dm-crypt mapping established
489              for LUKS header requested for conversion.
490
491              --type option is mandatory with following accepted values: luks1
492              or luks2.
493
494              WARNING:  The  convert action can destroy the LUKS header in the
495              case of a crash during conversion or if a  media  error  occurs.
496              Always create a header backup before performing this operation!
497
498              <options> can be [--header, --type].
499
500       config <device>
501
502              Set permanent configuration options (store to LUKS header).  The
503              config command is supported only for LUKS2.
504
505              The permanent options can be --priority to set priority (normal,
506              prefer, ignore) for keyslot (specified by --key-slot) or --label
507              and --subsystem.
508
509              <options> can be [--priority, --label, --subsystem,  --key-slot,
510              --header].
511
512

loop-AES EXTENSION

514       cryptsetup  supports  mapping loop-AES encrypted partition using a com‐
515       patibility mode.
516
517       open --type loopaes <device> <name> --key-file <keyfile>
518       loopaesOpen <device> <name> --key-file <keyfile>  (old syntax)
519
520              Opens the loop-AES <device> and sets up a mapping <name>.
521
522              If the key file is encrypted with GnuPG, then you  have  to  use
523              --key-file=- and decrypt it before use, e.g. like this:
524              gpg  --decrypt  <keyfile>  | cryptsetup loopaesOpen --key-file=-
525              <device> <name>
526
527              WARNING: The loop-AES extension cannot use the direct  input  of
528              key file on real terminal because the keys are separated by end-
529              of-line and only part of the multi-key file would be read.
530              If you need it in script, just use the pipe redirection:
531              echo $keyfile |  cryptsetup  loopaesOpen  --key-file=-  <device>
532              <name>
533
534              Use --keyfile-size to specify the proper key length if needed.
535
536              Use  --offset to specify device offset. Note that the units need
537              to be specified in number of 512 byte sectors.
538
539              Use --skip to specify the IV offset. If the original device used
540              an  offset and but did not use it in IV sector calculations, you
541              have to explicitly use --skip 0 in addition to the offset param‐
542              eter.
543
544              Use  --hash to override the default hash function for passphrase
545              hashing (otherwise it is detected according to key size).
546
547              <options> can  be  [--key-file,  --key-size,  --offset,  --skip,
548              --hash, --readonly, --allow-discards].
549
550       See  also  section 7 of the FAQ and http://loop-aes.sourceforge.net for
551       more information regarding loop-AES.
552

TCRYPT (TrueCrypt-compatible and VeraCrypt) EXTENSION

554       cryptsetup supports mapping of TrueCrypt,  tcplay  or  VeraCrypt  (with
555       --veracrypt  option)  encrypted  partition  using a native Linux kernel
556       API.  Header formatting and TCRYPT  header  change  is  not  supported,
557       cryptsetup never changes TCRYPT header on-device.
558
559       TCRYPT  extension  requires kernel userspace crypto API to be available
560       (introduced in Linux kernel 2.6.38).  If  you  are  configuring  kernel
561       yourself,  enable  "User-space interface for symmetric key cipher algo‐
562       rithms" in "Cryptographic API" section (CRYPTO_USER_API_SKCIPHER  .con‐
563       fig option).
564
565       Because  TCRYPT  header  is encrypted, you have to always provide valid
566       passphrase and keyfiles.
567
568       Cryptsetup should recognize all header variants, except  legacy  cipher
569       chains  using LRW encryption mode with 64 bits encryption block (namely
570       Blowfish in LRW mode is not recognized, this is  limitation  of  kernel
571       crypto API).
572
573       To  recognize a VeraCrypt device use the --veracrypt option.  VeraCrypt
574       is just extension of TrueCrypt header with increased iteration count so
575       unlocking  can  take  quite  a  lot  of time (in comparison with TCRYPT
576       device).
577
578       To open a VeraCrypt device with a custom Personal Iteration  Multiplier
579       (PIM)  value,  additionally  to  --veracrypt   use  either  the  --ver‐
580       acrypt-pim=<PIM> option to directly specify the  PIM  on  the  command-
581       line or use --veracrypt-query-pim to be prompted for the PIM.
582
583       The  PIM  value  affects  the  number  of iterations applied during key
584       derivation.   Please    refer    to    https://www.veracrypt.fr/en/Per
585       sonal%20Iterations%20Multiplier%20%28PIM%29.html   for   more  detailed
586       information.
587
588       NOTE: Activation with tcryptOpen is supported only  for  cipher  chains
589       using LRW or XTS encryption modes.
590
591       The  tcryptDump  command  should work for all recognized TCRYPT devices
592       and doesn't require superuser privilege.
593
594       To map system device (device with boot loader where the whole encrypted
595       system  resides)  use  --tcrypt-system  option.   You can use partition
596       device as the parameter (parameter must be real partition  device,  not
597       an image in a file), then only this partition is mapped.
598
599       If you have the whole TCRYPT device as a file image and you want to map
600       multiple partition encrypted  with  system  encryption,  please  create
601       loopback  mapping with partitions first (losetup -P, see losetup(8) man
602       page for more info), and use loop partition as the device parameter.
603
604       If you use the whole base device as a parameter,  one  device  for  the
605       whole  system  encryption  is  mapped.  This mode is available only for
606       backward compatibility with  older  cryptsetup  versions  which  mapped
607       TCRYPT system encryption using the whole device.
608
609       To  use  hidden  header  (and  map  hidden  device,  if available), use
610       --tcrypt-hidden option.
611
612       To  explicitly  use  backup  (secondary)  header,  use  --tcrypt-backup
613       option.
614
615       NOTE: There is no protection for a hidden volume if the outer volume is
616       mounted. The reason is that if there  were  any  protection,  it  would
617       require  some  metadata  describing what to protect in the outer volume
618       and the hidden volume would become detectable.
619
620
621       open --type tcrypt <device> <name>
622       tcryptOpen <device> <name>  (old syntax)
623
624              Opens the TCRYPT (a TrueCrypt-compatible) <device> and sets up a
625              mapping <name>.
626
627              <options>  can be [--key-file, --tcrypt-hidden, --tcrypt-system,
628              --tcrypt-backup,  --readonly,  --test-passphrase,   --allow-dis‐
629              cards, --veracrypt, --veracrypt-pim, --veracrypt-query-pim].
630
631              The  keyfile parameter allows a combination of file content with
632              the passphrase and can be repeated. Note that using keyfiles  is
633              compatible with TCRYPT and is different from LUKS keyfile logic.
634
635              WARNING:  Option --allow-discards cannot be combined with option
636              --tcrypt-hidden. For normal mapping, it can cause  the  destruc‐
637              tion of hidden volume (hidden volume appears as unused space for
638              outer volume so this space can be discarded).
639
640
641       tcryptDump <device>
642
643              Dump the header information of a TCRYPT device.
644
645              If the --dump-master-key option is used, the TCRYPT device  mas‐
646              ter key is dumped instead of TCRYPT header info. Beware that the
647              master key (or concatenated master keys if cipher chain is used)
648              can  be  used to decrypt the data stored in the TCRYPT container
649              without a passphrase.  This means that if the master key is com‐
650              promised,  the  whole device has to be erased to prevent further
651              access. Use this option carefully.
652
653              <options> can be [--dump-master-key,  --key-file,  --tcrypt-hid‐
654              den, --tcrypt-system, --tcrypt-backup].
655
656              The  keyfile parameter allows a combination of file content with
657              the passphrase and can be repeated.
658
659       See also https://en.wikipedia.org/wiki/TrueCrypt for  more  information
660       regarding TrueCrypt.
661
662       Please  note that cryptsetup does not use TrueCrypt code, please report
663       all problems related to this compatibility extension to the  cryptsetup
664       project.
665

MISCELLANEOUS

667       repair <device>
668
669              Tries  to repair the device metadata if possible. Currently sup‐
670              ported only for LUKS device type.
671
672              This command is useful to fix some known  benign  LUKS  metadata
673              header corruptions. Only basic corruptions of unused keyslot are
674              fixable. This command will only change the LUKS header, not  any
675              key-slot  data.  You  may  enforce LUKS version by adding --type
676              option.
677
678              WARNING: Always create a binary backup of  the  original  header
679              before calling this command.
680
681       benchmark <options>
682
683              Benchmarks  ciphers  and KDF (key derivation function).  Without
684              parameters, it tries to measure few common configurations.
685
686              To benchmark  other  ciphers  or  modes,  you  need  to  specify
687              --cipher and --key-size options or --hash for KDF test.
688
689              NOTE:  This  benchmark is using memory only and is only informa‐
690              tive.  You cannot directly predict real storage encryption speed
691              from it.
692
693              For  testing  block  ciphers,  this  benchmark  requires  kernel
694              userspace crypto API to be available (introduced in Linux kernel
695              2.6.38).   If you are configuring kernel yourself, enable "User-
696              space interface for symmetric key cipher algorithms" in "Crypto‐
697              graphic API" section (CRYPTO_USER_API_SKCIPHER .config option).
698
699              <options> can be [--cipher, --key-size, --hash].
700

OPTIONS

702       --verbose, -v
703              Print more information on command execution.
704
705       --debug
706              Run  in debug mode with full diagnostic logs. Debug output lines
707              are always prefixed by '#'.
708
709       --type <device-type>
710              Specifies required device type, for more info  read  BASIC  COM‐
711              MANDS section.
712
713       --hash, -h <hash-spec>
714              Specifies  the  passphrase  hash for open (for plain and loopaes
715              device types).
716
717              Specifies the hash used in the LUKS key setup scheme and  volume
718              key  digest  for luksFormat. The specified hash is used as hash-
719              parameter for PBKDF2 and for the AF splitter.
720
721              The specified hash name is  passed  to  the  compiled-in  crypto
722              backend.   Different backends may support different hashes.  For
723              luksFormat, the hash algorithm must provide at least 160 bits of
724              output,  which excludes, e.g., MD5. Do not use a non-crypto hash
725              like "crc32" as this breaks security.
726
727              Values compatible with old version of cryptsetup are "ripemd160"
728              for open --type plain and "sha1" for luksFormat.
729
730              Use cryptsetup --help to show the defaults.
731
732       --cipher, -c <cipher-spec>
733              Set the cipher specification string.
734
735              cryptsetup  --help  shows the compiled-in defaults.  The current
736              default in the distributed sources is "aes-cbc-essiv:sha256" for
737              plain dm-crypt and "aes-xts-plain64" for LUKS.
738
739              If  a  hash is part of the cipher specification, then it is used
740              as part of the IV generation. For example, ESSIV  needs  a  hash
741              function, while "plain64" does not and hence none is specified.
742
743              For  XTS mode you can optionally set a key size of 512 bits with
744              the -s option. Key size for XTS mode is  twice  that  for  other
745              modes for the same security level.
746
747              XTS  mode  requires  kernel 2.6.24 or later and plain64 requires
748              kernel 2.6.33 or later. More information can  be  found  in  the
749              FAQ.
750
751       --verify-passphrase, -y
752              When interactively asking for a passphrase, ask for it twice and
753              complain if both inputs do not match. Advised  when  creating  a
754              regular  mapping for the first time, or when running luksFormat.
755              Ignored on input from file or stdin.
756
757       --key-file, -d name
758              Read the passphrase from file.
759
760              If the name given is "-", then the passphrase will be read  from
761              stdin.   In  this case, reading will not stop at newline charac‐
762              ters.
763
764              With LUKS, passphrases supplied via --key-file  are  always  the
765              existing  passphrases requested by a command, except in the case
766              of luksFormat where --key-file is equivalent to  the  positional
767              key file argument.
768
769              If  you  want  to set a new passphrase via key file, you have to
770              use a positional argument to luksAddKey.
771
772              See section NOTES ON PASSPHRASE PROCESSING for more information.
773
774       --keyfile-offset value
775              Skip value bytes at the beginning of the key file.   Works  with
776              all commands that accept key files.
777
778       --keyfile-size, -l value
779              Read a maximum of value bytes from the key file.  The default is
780              to read the whole file up to the compiled-in maximum that can be
781              queried  with  --help.  Supplying more data than the compiled-in
782              maximum aborts the operation.
783
784              This option is useful to cut trailing newlines, for example.  If
785              --keyfile-offset  is also given, the size count starts after the
786              offset.  Works with all commands that accept key files.
787
788       --new-keyfile-offset value
789              Skip value bytes at the start when adding a new passphrase  from
790              key file with luksAddKey.
791
792       --new-keyfile-size  value
793              Read  a maximum of value bytes when adding a new passphrase from
794              key file with luksAddKey.  The default is to read the whole file
795              up  to  the  compiled-in maximum length that can be queried with
796              --help.  Supplying more than the compiled in maximum aborts  the
797              operation.   When  --new-keyfile-offset  is  also given, reading
798              starts after the offset.
799
800       --master-key-file
801              Use a master key stored in a file.
802
803              For luksFormat this allows creating a LUKS header with this spe‐
804              cific  master  key. If the master key was taken from an existing
805              LUKS header and all other parameters are the same, then the  new
806              header  decrypts  the  data encrypted with the header the master
807              key was taken from.
808
809              Action luksDump together with --dump-master-key option: The vol‐
810              ume  (master)  key  is stored in a file instead of being printed
811              out to standard output.
812
813              WARNING: If you create your own master key,  you  need  to  make
814              sure  to  do  it  right.  Otherwise,  you can end up with a low-
815              entropy or otherwise partially predictable master key which will
816              compromise security.
817
818              For  luksAddKey this allows adding a new passphrase without hav‐
819              ing to know an existing one.
820
821              For open this allows one to open the LUKS device without  giving
822              a passphrase.
823
824       --dump-master-key
825              For  luksDump  this  option  includes the master key in the dis‐
826              played information. Use with care, as the master key can be used
827              to bypass the passphrases, see also option --master-key-file.
828
829       --json-file
830              Read  token  json  from  a  file or write token to it. See token
831              action for more information. --json-file=- reads json from stan‐
832              dard input or writes it to standard output respectively.
833
834       --use-random
835
836       --use-urandom
837              For  luksFormat  these options define which kernel random number
838              generator will be used to create the  master  key  (which  is  a
839              long-term key).
840
841              See  NOTES ON RANDOM NUMBER GENERATORS for more information. Use
842              cryptsetup --help to show the compiled-in default random  number
843              generator.
844
845              WARNING:  In  a  low-entropy situation (e.g. in an embedded sys‐
846              tem), both selections are problematic.  Using  /dev/urandom  can
847              lead  to  weak  keys.   Using /dev/random can block a long time,
848              potentially forever, if not enough entropy can be  harvested  by
849              the kernel.
850
851       --key-slot, -S <0-7>
852              For  LUKS  operations that add key material, this options allows
853              you to specify which key slot is selected for the new key.  This
854              option can be used for luksFormat, and luksAddKey.
855              In  addition,  for open, this option selects a specific key-slot
856              to compare the passphrase  against.   If  the  given  passphrase
857              would only match a different key-slot, the operation fails.
858
859       --key-size, -s <bits>
860              Sets  key  size in bits. The argument has to be a multiple of 8.
861              The possible key-sizes are limited by the cipher and mode used.
862
863              See /proc/crypto for more information.  Note  that  key-size  in
864              /proc/crypto is stated in bytes.
865
866              This  option  can  be  used for open --type plain or luksFormat.
867              All other LUKS actions will use the key-size  specified  in  the
868              LUKS  header.   Use  cryptsetup  --help  to show the compiled-in
869              defaults.
870
871       --size, -b <number of 512 byte sectors>
872              Set the size of the device in sectors of 512 bytes.  This option
873              is only relevant for the open and resize actions.
874
875       --offset, -o <number of 512 byte sectors>
876              Start  offset  in  the backend device in 512-byte sectors.  This
877              option is only relevant  for  the  open  action  with  plain  or
878              loopaes device types.
879
880       --skip, -p <number of 512 byte sectors>
881              Start  offset  used  in  IV calculation in 512-byte sectors (how
882              many sectors of the encrypted data to skip  at  the  beginning).
883              This  option  is only relevant for the open action with plain or
884              loopaes device types.
885
886              Hence, if --offset n, and --skip s, sector n (the  first  sector
887              of  the  encrypted device) will get a sector number of s for the
888              IV calculation.
889
890       --readonly, -r
891              set up a read-only mapping.
892
893       --shared
894              Creates an additional mapping for one common ciphertext  device.
895              Arbitrary  mappings are supported.  This option is only relevant
896              for the open --type  plain  action.  Use  --offset,  --size  and
897              --skip to specify the mapped area.
898
899       --pbkdf <PBKDF spec>
900              Set Password-Based Key Derivation Function (PBKDF) algorithm for
901              LUKS keyslot.  The PBKDF can be: pbkdf2 (for PBKDF2 according to
902              RFC2898),  argon2i  for  Argon2i  or  argon2id for Argon2id (see
903              https://www.cryptolux.org/index.php/Argon2 for more info).
904
905              For LUKS1, only PBKDF2 is accepted (no need to use this option).
906              The  default PBKDF2 for LUKS2 is set during compilation time and
907              is available in cryptsetup --help output.
908
909              A PBKDF is used for increasing dictionary and brute-force attack
910              cost  for  keyslot passwords. The parameters can be time, memory
911              and parallel cost.
912
913              For PBKDF2, only time cost (number of iterations) applies.   For
914              Argon2i/id,  there  is  also memory cost (memory required during
915              the process of key derivation)  and  parallel  cost  (number  of
916              threads that run in parallel during the key derivation.
917
918              Note  that  increasing  memory  cost also increases time, so the
919              final parameter values are measured by a benchmark.  The  bench‐
920              mark  tries  to  find iteration time (--iter-time) with required
921              memory cost --pbkdf-memory. If it is not  possible,  the  memory
922              cost  is  decreased as well.  The parallel cost --pbkdf-parallel
923              is constant, is is checked against available CPU cores  (if  not
924              available, it is decreased) and the maximum parallel cost is 4.
925
926              You  can  see  all PBKDF parameters for particular LUKS2 keyslot
927              with luksDump command.
928
929              NOTE: If you do not want to use benchmark and  want  to  specify
930              all   parameters  directly,  use  --pbkdf-force-iterations  with
931              --pbkdf-memory and --pbkdf-parallel.   This  will  override  the
932              values  without  benchmarking.  Note it can cause extremely long
933              unlocking time. Use only is specified cases, for example, if you
934              know that the formatted device will be used on some small embed‐
935              ded system.  In this case, the LUKS PBKDF2 digest will be set to
936              the minimum iteration count.
937
938       --iter-time, -i <number of milliseconds>
939              The  number  of milliseconds to spend with PBKDF passphrase pro‐
940              cessing.  This option is only relevant for LUKS operations  that
941              set  or  change  passphrases,  such as luksFormat or luksAddKey.
942              Specifying 0 as parameter selects the compiled-in default.
943
944       --pbkdf-memory <number>
945              Set the memory cost for PBKDF (for Argon2i/id the number  repre‐
946              sents  kilobytes).   Note that it is maximal value, PBKDF bench‐
947              mark or available physical memory can decrease it.  This  option
948              is not available for PBKDF2.
949
950       --pbkdf-parallel <number>
951              Set  the  parallel  cost for PBKDF (number of threads, up to 4).
952              Note that it is maximal value, it is decreased automatically  if
953              CPU  online  count  is  lower.  This option is not available for
954              PBKDF2.
955
956       --pbkdf-force-iterations <num>
957              Avoid PBKDF benchmark and set time cost  (iterations)  directly.
958              It  can  be used for LUKS/LUKS2 device only.  See --pbkdf option
959              for more info.
960
961       --batch-mode, -q
962              Suppresses all confirmation questions. Use with care!
963
964              If the -y option is not specified, this option also switches off
965              the passphrase verification for luksFormat.
966
967       --progress-frequency <seconds>
968              Print separate line every <seconds> with wipe progress.
969
970       --timeout, -t <number of seconds>
971              The number of seconds to wait before timeout on passphrase input
972              via terminal. It is relevant every time a passphrase  is  asked,
973              for  example  for  open,  luksFormat  or  luksAddKey.  It has no
974              effect if used in conjunction with --key-file.
975              This option is useful when the system should not  stall  if  the
976              user  does not input a passphrase, e.g. during boot. The default
977              is a value of 0 seconds, which means to wait forever.
978
979       --tries, -T
980              How often the input of the passphrase shall  be  retried.   This
981              option is relevant every time a passphrase is asked, for example
982              for open, luksFormat or luksAddKey.  The default is 3 tries.
983
984       --align-payload <number of 512 byte sectors>
985              Align payload at a boundary of  value  512-byte  sectors.   This
986              option is relevant for luksFormat.
987
988              If not specified, cryptsetup tries to use the topology info pro‐
989              vided by the kernel for the underlying device to get the optimal
990              alignment.   If not available (or the calculated value is a mul‐
991              tiple of the default) data is  by  default  aligned  to  a  1MiB
992              boundary (i.e. 2048 512-byte sectors).
993
994              For  a detached LUKS header, this option specifies the offset on
995              the data device. See also the --header option.
996
997       --uuid=UUID
998              Use the provided UUID for the luksFormat command instead of gen‐
999              erating  a new one. Changes the existing UUID when used with the
1000              luksUUID command.
1001
1002              The UUID must be provided in  the  standard  UUID  format,  e.g.
1003              12345678-1234-1234-1234-123456789abc.
1004
1005       --allow-discards
1006              Allow  the  use of discard (TRIM) requests for the device.  This
1007              option is only relevant for open action.
1008
1009              WARNING: This  command  can  have  a  negative  security  impact
1010              because  it  can make filesystem-level operations visible on the
1011              physical device. For  example,  information  leaking  filesystem
1012              type,  used  space,  etc.  may  be extractable from the physical
1013              device if the discarded blocks  can  be  located  later.  If  in
1014              doubt, do not use it.
1015
1016              A kernel version of 3.1 or later is needed. For earlier kernels,
1017              this option is ignored.
1018
1019       --perf-same_cpu_crypt
1020              Perform encryption using the same cpu that IO was submitted  on.
1021              The  default  is  to use an unbound workqueue so that encryption
1022              work is automatically balanced  between  available  CPUs.   This
1023              option is only relevant for open action.
1024
1025              NOTE:  This option is available only for low-level dm-crypt per‐
1026              formance tuning, use only if you need a change  to  default  dm-
1027              crypt behaviour. Needs kernel 4.0 or later.
1028
1029       --perf-submit_from_crypt_cpus
1030              Disable offloading writes to a separate thread after encryption.
1031              There are some situations where offloading write bios  from  the
1032              encryption  threads to a single thread degrades performance sig‐
1033              nificantly.  The default is to offload write bios  to  the  same
1034              thread.  This option is only relevant for open action.
1035
1036              NOTE:  This option is available only for low-level dm-crypt per‐
1037              formance tuning, use only if you need a change  to  default  dm-
1038              crypt behaviour. Needs kernel 4.0 or later.
1039
1040       --test-passphrase
1041              Do not activate the device, just verify passphrase.  This option
1042              is only relevant for open action (the device mapping name is not
1043              mandatory if this option is used).
1044
1045       --header <device or file storing the LUKS header>
1046              Use  a  detached  (separated)  metadata device or file where the
1047              LUKS header is stored. This option allows one to  store  cipher‐
1048              text and LUKS header on different devices.
1049
1050              This  option  is  only relevant for LUKS devices and can be used
1051              with the luksFormat, open, luksSuspend, luksResume,  status  and
1052              resize commands.
1053
1054              For luksFormat with a file name as the argument to --header, the
1055              file will be automatically created if it does  not  exist.   See
1056              the cryptsetup FAQ for header size calculation.
1057
1058              For  other  commands  that change the LUKS header (e.g. luksAdd‐
1059              Key), specify the device or file with the LUKS  header  directly
1060              as the LUKS device.
1061
1062              If  used with luksFormat, the --align-payload option is taken as
1063              absolute sector alignment on ciphertext device and can be zero.
1064
1065              WARNING: There is no check whether the ciphertext device  speci‐
1066              fied  actually  belongs  to  the  header given. In fact, you can
1067              specify an arbitrary device as the ciphertext  device  for  open
1068              with the --header option. Use with care.
1069
1070       --header-backup-file <file>
1071              Specify  file  with  header  backup for luksHeaderBackup or luk‐
1072              sHeaderBackup actions.
1073
1074       --force-password
1075              Do not use password quality checking for new LUKS passwords.
1076
1077              This  option  applies  only  to   luksFormat,   luksAddKey   and
1078              luksChangeKey  and  is  ignored  if  cryptsetup is built without
1079              password quality checking support.
1080
1081              For more info about password quality check, see the manual  page
1082              for pwquality.conf(5) and passwdqc.conf(5).
1083
1084       --deferred
1085              Defers  device  removal  in  close  command  until the last user
1086              closes it.
1087
1088       --disable-locks
1089              Disable lock protection for metadata on disk.   This  option  is
1090              valid only for LUKS2 and ignored for other formats.
1091
1092              WARNING:  Do  not use this option unless you run cryptsetup in a
1093              restricted environment where locking is  impossible  to  perform
1094              (where /run directory cannot be used).
1095
1096       --disable-keyring
1097              Do  not  load  volume  key  in  kernel keyring but use store key
1098              directly in the dm-crypt target.  This option is supported  only
1099              for the LUKS2 format.
1100
1101       --key-description <text>
1102              Set key description in keyring for use with token command.
1103
1104       --priority <normal|prefer|ignore>
1105              Set  a  priority  for LUKS2 keyslot.  The prefer priority marked
1106              slots are tried before normal priority.   The  ignored  priority
1107              means,  that  slot is never used, if not explicitly requested by
1108              --key-slot option.
1109
1110       --token-id
1111              Specify what token to use in actions token, open or resize.   If
1112              omitted,  all available tokens will be checked before proceeding
1113              further with passphrase prompt.
1114
1115       --token-only
1116              Do not proceed further  with  action  (any  of  token,  open  or
1117              resize)  if  token activation failed. Without the option, action
1118              asks for passphrase to proceed further.
1119
1120       --sector-size <bytes>
1121              Set sector size for use with disk encryption. It must  be  power
1122              of  two  and in range 512 - 4096 bytes. The default is 512 bytes
1123              sectors.  This option is available only in the LUKS2 mode.
1124
1125              Note that if sector size is higher than underlying device  hard‐
1126              ware sector and there is not integrity protection that uses data
1127              journal, using this option can increase risk on incomplete  sec‐
1128              tor writes during a power fail.
1129
1130              If  used together with --integrity option and dm-integrity jour‐
1131              nal, the atomicity of writes is guaranteed in all cases (but  it
1132              cost write performance - data has to be written twice).
1133
1134              Increasing  sector size from 512 bytes to 4096 bytes can provide
1135              better performance on most of the  modern  storage  devices  and
1136              also with some hw encryption accelerators.
1137
1138       --persistent
1139              If  used  with  LUKS2 devices and activation commands like open,
1140              the specified activation flags  are  persistently  written  into
1141              metadata  and used next time automatically even for normal acti‐
1142              vation.  (No need to use cryptab or other  system  configuration
1143              files.)      Only    --allow-discards,    --perf-same_cpu_crypt,
1144              --perf-submit_from_crypt_cpus and --integrity-no-journal can  be
1145              stored persistently.
1146
1147       --label <LABEL>
1148              --subsystem  <SUBSYSTEM> Set label and subsystem description for
1149              LUKS2 device, can be used in config  and  format  actions.   The
1150              label and subsystem are optional fields and can be later used in
1151              udev scripts for triggering user actions once device  marked  by
1152              these labels is detected.
1153
1154       --integrity <integrity algorithm>
1155              Specify  integrity  algorithm  to be used for authenticated disk
1156              encryption in LUKS2.
1157
1158              WARNING:  This  extension  is  EXPERIMENTAL  and  requires   dm-
1159              integrity  kernel  target (available since kernel version 4.12).
1160              For native AEAD modes, also  enable  "User-space  interface  for
1161              AEAD  cipher  algorithms"  in  "Cryptographic API" section (CON‐
1162              FIG_CRYPTO_USER_API_AEAD .config option).
1163
1164              For more info, see AUTHENTICATED DISK ENCRYPTION section.
1165
1166       --integrity-no-journal
1167              Activate device with integrity  protection  without  using  data
1168              journal  (direct  write  of data and integrity tags).  Note that
1169              without journal power fail can cause non-atomic write  and  data
1170              corruption.  Use only if journalling is performed on a different
1171              storage layer.
1172
1173       --integrity-no-wipe
1174              Skip wiping of device authentication (integrity)  tags.  If  you
1175              skip  this step, sectors will report invalid integrity tag until
1176              an application write to the sector.
1177
1178              NOTE: Even some writes to the device can fail if  the  write  is
1179              not aligned to page size and page-cache initiates read of a sec‐
1180              tor with invalid integrity tag.
1181
1182       --unbound
1183
1184              Creates new LUKS2 unbound keyslot.  See  luksAddKey  action  for
1185              more details.
1186
1187       --tcrypt-hidden
1188              --tcrypt-system  --tcrypt-backup Specify which TrueCrypt on-disk
1189              header will be used to open the device.  See TCRYPT section  for
1190              more info.
1191
1192       --veracrypt
1193              Allow VeraCrypt compatible mode. Only for TCRYPT extension.  See
1194              TCRYPT section for more info.
1195
1196       --veracrypt-pim
1197              --veracrypt-query-pim Use a custom Personal Iteration Multiplier
1198              (PIM) for VeraCrypt device.  See TCRYPT section for more info.
1199
1200       --version
1201              Show the program version.
1202
1203       --usage
1204              Show short option help.
1205
1206       --help, -?
1207              Show help text and default parameters.
1208

RETURN CODES

1210       Cryptsetup returns 0 on success and a non-zero value on error.
1211
1212       Error  codes are: 1 wrong parameters, 2 no permission (bad passphrase),
1213       3 out of memory, 4 wrong device specified, 5 device already  exists  or
1214       device is busy.
1215

NOTES ON PASSPHRASE PROCESSING FOR PLAIN MODE

1217       Note  that  no  iterated  hashing or salting is done in plain mode.  If
1218       hashing is done, it is a single  direct  hash.  This  means  that  low-
1219       entropy passphrases are easy to attack in plain mode.
1220
1221       From  a  terminal: The passphrase is read until the first newline, i.e.
1222       '\n'.  The input without the newline character is  processed  with  the
1223       default  hash  or the hash specified with --hash.  The hash result will
1224       be truncated to the key size of the used cipher, or the size  specified
1225       with -s.
1226
1227       From stdin: Reading will continue until a newline (or until the maximum
1228       input size is reached), with the trailing newline stripped. The maximum
1229       input  size is defined by the same compiled-in default as for the maxi‐
1230       mum key file size and can be overwritten using --keyfile-size option.
1231
1232       The data read will be hashed with the default hash or the  hash  speci‐
1233       fied with --hash.  The hash result will be truncated to the key size of
1234       the used cipher, or the size specified with -s.
1235
1236       Note that if --key-file=- is used  for  reading  the  key  from  stdin,
1237       trailing newlines are not stripped from the input.
1238
1239       If  "plain"  is  used as argument to --hash, the input data will not be
1240       hashed. Instead, it will be zero padded (if shorter than the key  size)
1241       or  truncated  (if  longer  than the key size) and used directly as the
1242       binary key. This is useful for directly specifying a  binary  key.   No
1243       warning  will  be  given  if the amount of data read from stdin is less
1244       than the key size.
1245
1246       From a key file: It will be truncated to  the  key  size  of  the  used
1247       cipher or the size given by -s and directly used as a binary key.
1248
1249       WARNING:  The  --hash  argument is being ignored.  The --hash option is
1250       usable only for stdin input in plain mode.
1251
1252       If the key file is shorter than the key, cryptsetup will quit  with  an
1253       error.   The  maximum  input  size  is  defined by the same compiled-in
1254       default as for the maximum key file size and can be  overwritten  using
1255       --keyfile-size option.
1256
1257
1258

NOTES ON PASSPHRASE PROCESSING FOR LUKS

1260       LUKS uses PBKDF2 to protect against dictionary attacks and to give some
1261       protection to low-entropy passphrases (see RFC 2898 and the  cryptsetup
1262       FAQ).
1263
1264       From  a  terminal:  The  passphrase is read until the first newline and
1265       then processed by PBKDF2 without the newline character.
1266
1267       From stdin: LUKS will read passphrases from stdin up to the first  new‐
1268       line  character  or  the compiled-in maximum key file length. If --key‐
1269       file-size is given, it is ignored.
1270
1271       From key file: The complete keyfile is read up to the compiled-in maxi‐
1272       mum  size.  Newline  characters  do not terminate the input. The --key‐
1273       file-size option can be used to limit what is read.
1274
1275       Passphrase processing: Whenever a passphrase is added to a LUKS  header
1276       (luksAddKey,  luksFormat),  the  user may specify how much the time the
1277       passphrase processing should consume. The time is used to determine the
1278       iteration  count  for PBKDF2 and higher times will offer better protec‐
1279       tion for low-entropy passphrases, but open will  take  longer  to  com‐
1280       plete.  For  passphrases  that  have  entropy  higher than the used key
1281       length, higher iteration times will not increase security.
1282
1283       The default setting of one or two seconds is sufficient for most  prac‐
1284       tical  cases.  The only exception is a low-entropy passphrase used on a
1285       device with a slow CPU, as this will result in a low  iteration  count.
1286       On  a  slow  device, it may be advisable to increase the iteration time
1287       using the --iter-time option in order  to  obtain  a  higher  iteration
1288       count. This does slow down all later luksOpen operations accordingly.
1289

INCOHERENT BEHAVIOR FOR INVALID PASSPHRASES/KEYS

1291       LUKS  checks  for  a  valid  passphrase  when an encrypted partition is
1292       unlocked. The behavior of plain dm-crypt is different.  It will  always
1293       decrypt  with  the  passphrase given. If the given passphrase is wrong,
1294       the device mapped by plain  dm-crypt  will  essentially  still  contain
1295       encrypted data and will be unreadable.
1296

NOTES ON SUPPORTED CIPHERS, MODES, HASHES AND KEY SIZES

1298       The  available  combinations  of  ciphers,  modes, hashes and key sizes
1299       depend on kernel support. See /proc/crypto  for  a  list  of  available
1300       options.  You  might  need  to load additional kernel crypto modules in
1301       order to get more options.
1302
1303       For the --hash option, if the crypto backend  is  libgcrypt,  then  all
1304       algorithms  supported  by  the gcrypt library are available.  For other
1305       crypto backends, some algorithms may be missing.
1306

NOTES ON PASSPHRASES

1308       Mathematics can't be bribed. Make sure you keep your passphrases  safe.
1309       There  are a few nice tricks for constructing a fallback, when suddenly
1310       out of the blue, your brain refuses to cooperate.  These fallbacks need
1311       LUKS,  as  it's  only  possible with LUKS to have multiple passphrases.
1312       Still, if your  attacker  model  does  not  prevent  it,  storing  your
1313       passphrase in a sealed envelope somewhere may be a good idea as well.
1314

NOTES ON RANDOM NUMBER GENERATORS

1316       Random Number Generators (RNG) used in cryptsetup are always the kernel
1317       RNGs without any modifications or additions to data stream produced.
1318
1319       There are two types  of  randomness  cryptsetup/LUKS  needs.  One  type
1320       (which always uses /dev/urandom) is used for salts, the AF splitter and
1321       for wiping deleted keyslots.
1322
1323       The second type is used for the volume (master)  key.  You  can  switch
1324       between  using /dev/random and /dev/urandom  here, see --use-random and
1325       --use-urandom options. Using /dev/random on  a  system  without  enough
1326       entropy  sources  can  cause  luksFormat  to  block until the requested
1327       amount of random data is gathered. In a low-entropy situation (embedded
1328       system), this can take a very long time and potentially forever. At the
1329       same time, using /dev/urandom in a low-entropy situation  will  produce
1330       low-quality  keys.  This is a serious problem, but solving it is out of
1331       scope for a mere man-page.  See urandom(4) for more information.
1332

AUTHENTICATED DISK ENCRYPTION (EXPERIMENTAL)

1334       Since Linux kernel version 4.12 dm-crypt  supports  authenticated  disk
1335       encryption.
1336
1337       Normal disk encryption modes are length-preserving (plaintext sector is
1338       of the same size as a ciphertext sector) and can provide only confiden‐
1339       tiality protection, but not cryptographically sound data integrity pro‐
1340       tection.
1341
1342       Authenticated modes require additional space per-sector for authentica‐
1343       tion  tag  and use Authenticated Encryption with Additional Data (AEAD)
1344       algorithms.
1345
1346       If you configure LUKS2 device with  data  integrity  protection,  there
1347       will  be  an  underlying dm-integrity device, which provides additional
1348       per-sector metadata space and also provide data journal  protection  to
1349       ensure  atomicity  of  data and metadata update.  Because there must be
1350       additional space for metadata and journal, the available space for  the
1351       device will be smaller than for length-preserving modes.
1352
1353       The  dm-crypt device then resides on top of such a dm-integrity device.
1354       All activation and deactivation of this device stack  is  performed  by
1355       cryptsetup, there is no difference in using luksOpen for integrity pro‐
1356       tected devices.  If you want to format LUKS2 device with data integrity
1357       protection, use --integrity option.
1358
1359       Some  integrity modes requires two independent keys (key for encryption
1360       and for authentication).  Both  these  keys  are  stored  in  one  LUKS
1361       keyslot.
1362
1363       WARNING:  All support for authenticated modes is experimental and there
1364       are only some modes available for now. Note that there are a  very  few
1365       authenticated  encryption algorithms that are suitable for disk encryp‐
1366       tion.
1367
1368

NOTES ON LOOPBACK DEVICE USE

1370       Cryptsetup is usually used directly on a block device  (disk  partition
1371       or  LVM  volume). However, if the device argument is a file, cryptsetup
1372       tries to allocate a loopback device and map it  into  this  file.  This
1373       mode  requires  Linux  kernel  2.6.25 or more recent which supports the
1374       loop autoclear flag (loop device is cleared on the last close automati‐
1375       cally). Of course, you can always map a file to a loop-device manually.
1376       See the cryptsetup FAQ for an example.
1377
1378       When device mapping is active, you can see the loop backing file in the
1379       status command output. Also see losetup(8).
1380

LUKS2 header locking

1382       The  LUKS2  on-disk metadata is updated in several steps and to achieve
1383       proper atomic update, there is a locking mechanism.  For  an  image  in
1384       file, code uses flock(2) system call.  For a block device, lock is per‐
1385       formed over a special file stored in a locking  directory  (by  default
1386       /run/lock/cryptsetup).   The  locking  directory should be created with
1387       the proper security context by  the  distribution  during  the  boot-up
1388       phase.  Only LUKS2 uses locks, other formats do not use this mechanism.
1389

DEPRECATED ACTIONS

1391       The reload action is no longer supported.  Please use dmsetup(8) if you
1392       need to directly manipulate with the device mapping table.
1393
1394       The luksDelKey was replaced with luksKillSlot.
1395

REPORTING BUGS

1397       Report bugs, including ones in the  documentation,  on  the  cryptsetup
1398       mailing  list at <dm-crypt@saout.de> or in the 'Issues' section on LUKS
1399       website.  Please attach the output  of  the  failed  command  with  the
1400       --debug option added.
1401

AUTHORS

1403       cryptsetup originally written by Jana Saout <jana@saout.de>
1404       The LUKS extensions and original man page were written by Clemens Fruh‐
1405       wirth <clemens@endorphin.org>.
1406       Man page extensions by Milan Broz <gmazyland@gmail.com>.
1407       Man page rewrite and extension by Arno Wagner <arno@wagner.name>.
1408
1410       Copyright © 2004 Jana Saout
1411       Copyright © 2004-2006 Clemens Fruhwirth
1412       Copyright © 2009-2018 Red Hat, Inc.
1413       Copyright © 2009-2018 Milan Broz
1414       Copyright © 2012-2014 Arno Wagner
1415
1416       This is free software; see the source for copying conditions.  There is
1417       NO  warranty;  not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
1418       PURPOSE.
1419

SEE ALSO

1421       The LUKS website at https://gitlab.com/cryptsetup/cryptsetup/
1422
1423       The cryptsetup FAQ, contained in the distribution package and online at
1424       https://gitlab.com/cryptsetup/cryptsetup/wikis/FrequentlyAskedQuestions
1425
1426       The cryptsetup mailing list and list archive, see FAQ entry 1.6.
1427
1428       The   LUKS  on-disk  format  specification  available  at  https://git
1429       lab.com/cryptsetup/cryptsetup/wikis/Specification
1430
1431
1432
1433cryptsetup                       January 2018                    CRYPTSETUP(8)
Impressum