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> <device>
450
451              Adds a new  keyring  token  to  enable  auto-activation  of  the
452              device.   For the auto-activation, the passphrase must be stored
453              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              <options>   can   be    [--header,    --token-id,    --key-slot,
470              --key-description, --disable-locks, --disable-keyring].
471
472       convert <device> --type <format>
473
474              Converts the device between LUKS and LUKS2 format (if possible).
475              The conversion will not be performed if there is  an  additional
476              LUKS2 feature or LUKS has unsupported header size.
477
478              WARNING:  The  convert action can destroy the LUKS header in the
479              case of a crash during conversion or if a  media  error  occurs.
480              Always create a header backup before performing this operation!
481
482              <options> can be [--header, --type].
483
484       config <device>
485
486              Set permanent configuration options (store to LUKS header).  The
487              config command is supported only for LUKS2.
488
489              The permanent options can be --priority to set priority (normal,
490              prefer, ignore) for keyslot (specified by --key-slot) or --label
491              and --subsystem.
492
493              <options> can be [--priority, --label, --subsystem,  --key-slot,
494              --header].
495
496

loop-AES EXTENSION

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

TCRYPT (TrueCrypt-compatible and VeraCrypt) EXTENSION

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

MISCELLANEOUS

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

OPTIONS

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

RETURN CODES

1185       Cryptsetup returns 0 on success and a non-zero value on error.
1186
1187       Error  codes are: 1 wrong parameters, 2 no permission (bad passphrase),
1188       3 out of memory, 4 wrong device specified, 5 device already  exists  or
1189       device is busy.
1190

NOTES ON PASSPHRASE PROCESSING FOR PLAIN MODE

1192       Note  that  no  iterated  hashing or salting is done in plain mode.  If
1193       hashing is done, it is a single  direct  hash.  This  means  that  low-
1194       entropy passphrases are easy to attack in plain mode.
1195
1196       From  a  terminal: The passphrase is read until the first newline, i.e.
1197       '\n'.  The input without the newline character is  processed  with  the
1198       default  hash  or the hash specified with --hash.  The hash result will
1199       be truncated to the key size of the used cipher, or the size  specified
1200       with -s.
1201
1202       From stdin: Reading will continue until a newline (or until the maximum
1203       input size is reached), with the trailing newline stripped. The maximum
1204       input  size is defined by the same compiled-in default as for the maxi‐
1205       mum key file size and can be overwritten using --keyfile-size option.
1206
1207       The data read will be hashed with the default hash or the  hash  speci‐
1208       fied with --hash.  The hash result will be truncated to the key size of
1209       the used cipher, or the size specified with -s.
1210
1211       Note that if --key-file=- is used  for  reading  the  key  from  stdin,
1212       trailing newlines are not stripped from the input.
1213
1214       If  "plain"  is  used as argument to --hash, the input data will not be
1215       hashed. Instead, it will be zero padded (if shorter than the key  size)
1216       or  truncated  (if  longer  than the key size) and used directly as the
1217       binary key. This is useful for directly specifying a  binary  key.   No
1218       warning  will  be  given  if the amount of data read from stdin is less
1219       than the key size.
1220
1221       From a key file: It will be truncated to  the  key  size  of  the  used
1222       cipher or the size given by -s and directly used as a binary key.
1223
1224       WARNING:  The  --hash  argument is being ignored.  The --hash option is
1225       usable only for stdin input in plain mode.
1226
1227       If the key file is shorter than the key, cryptsetup will quit  with  an
1228       error.   The  maximum  input  size  is  defined by the same compiled-in
1229       default as for the maximum key file size and can be  overwritten  using
1230       --keyfile-size option.
1231
1232
1233

NOTES ON PASSPHRASE PROCESSING FOR LUKS

1235       LUKS uses PBKDF2 to protect against dictionary attacks and to give some
1236       protection to low-entropy passphrases (see RFC 2898 and the  cryptsetup
1237       FAQ).
1238
1239       From  a  terminal:  The  passphrase is read until the first newline and
1240       then processed by PBKDF2 without the newline character.
1241
1242       From stdin: LUKS will read passphrases from stdin up to the first  new‐
1243       line  character  or  the compiled-in maximum key file length. If --key‐
1244       file-size is given, it is ignored.
1245
1246       From key file: The complete keyfile is read up to the compiled-in maxi‐
1247       mum  size.  Newline  characters  do not terminate the input. The --key‐
1248       file-size option can be used to limit what is read.
1249
1250       Passphrase processing: Whenever a passphrase is added to a LUKS  header
1251       (luksAddKey,  luksFormat),  the  user may specify how much the time the
1252       passphrase processing should consume. The time is used to determine the
1253       iteration  count  for PBKDF2 and higher times will offer better protec‐
1254       tion for low-entropy passphrases, but open will  take  longer  to  com‐
1255       plete.  For  passphrases  that  have  entropy  higher than the used key
1256       length, higher iteration times will not increase security.
1257
1258       The default setting of one or two seconds is sufficient for most  prac‐
1259       tical  cases.  The only exception is a low-entropy passphrase used on a
1260       device with a slow CPU, as this will result in a low  iteration  count.
1261       On  a  slow  device, it may be advisable to increase the iteration time
1262       using the --iter-time option in order  to  obtain  a  higher  iteration
1263       count. This does slow down all later luksOpen operations accordingly.
1264

INCOHERENT BEHAVIOR FOR INVALID PASSPHRASES/KEYS

1266       LUKS  checks  for  a  valid  passphrase  when an encrypted partition is
1267       unlocked. The behavior of plain dm-crypt is different.  It will  always
1268       decrypt  with  the  passphrase given. If the given passphrase is wrong,
1269       the device mapped by plain  dm-crypt  will  essentially  still  contain
1270       encrypted data and will be unreadable.
1271

NOTES ON SUPPORTED CIPHERS, MODES, HASHES AND KEY SIZES

1273       The  available  combinations  of  ciphers,  modes, hashes and key sizes
1274       depend on kernel support. See /proc/crypto  for  a  list  of  available
1275       options.  You  might  need  to load additional kernel crypto modules in
1276       order to get more options.
1277
1278       For the --hash option, if the crypto backend  is  libgcrypt,  then  all
1279       algorithms  supported  by  the gcrypt library are available.  For other
1280       crypto backends, some algorithms may be missing.
1281

NOTES ON PASSPHRASES

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

NOTES ON RANDOM NUMBER GENERATORS

1291       Random Number Generators (RNG) used in cryptsetup are always the kernel
1292       RNGs without any modifications or additions to data stream produced.
1293
1294       There are two types  of  randomness  cryptsetup/LUKS  needs.  One  type
1295       (which always uses /dev/urandom) is used for salts, the AF splitter and
1296       for wiping deleted keyslots.
1297
1298       The second type is used for the volume (master)  key.  You  can  switch
1299       between  using /dev/random and /dev/urandom  here, see --use-random and
1300       --use-urandom options. Using /dev/random on  a  system  without  enough
1301       entropy  sources  can  cause  luksFormat  to  block until the requested
1302       amount of random data is gathered. In a low-entropy situation (embedded
1303       system), this can take a very long time and potentially forever. At the
1304       same time, using /dev/urandom in a low-entropy situation  will  produce
1305       low-quality  keys.  This is a serious problem, but solving it is out of
1306       scope for a mere man-page.  See urandom(4) for more information.
1307

AUTHENTICATED DISK ENCRYPTION (EXPERIMENTAL)

1309       Since Linux kernel version 4.12 dm-crypt  supports  authenticated  disk
1310       encryption.
1311
1312       Normal disk encryption modes are length-preserving (plaintext sector is
1313       of the same size as a ciphertext sector) and can provide only confiden‐
1314       tiality protection, but not cryptographically sound data integrity pro‐
1315       tection.
1316
1317       Authenticated modes require additional space per-sector for authentica‐
1318       tion  tag  and use Authenticated Encryption with Additional Data (AEAD)
1319       algorithms.
1320
1321       If you configure LUKS2 device with  data  integrity  protection,  there
1322       will  be  an  underlying dm-integrity device, which provides additional
1323       per-sector metadata space and also provide data journal  protection  to
1324       ensure  atomicity  of  data and metadata update.  Because there must be
1325       additional space for metadata and journal, the available space for  the
1326       device will be smaller than for length-preserving modes.
1327
1328       The  dm-crypt device then resides on top of such a dm-integrity device.
1329       All activation and deactivation of this device stack  is  performed  by
1330       cryptsetup, there is no difference in using luksOpen for integrity pro‐
1331       tected devices.  If you want to format LUKS2 device with data integrity
1332       protection, use --integrity option.
1333
1334       Some  integrity modes requires two independent keys (key for encryption
1335       and for authentication).  Both  these  keys  are  stored  in  one  LUKS
1336       keyslot.
1337
1338       WARNING:  All support for authenticated modes is experimental and there
1339       are only some modes available for now. Note that there are a  very  few
1340       authenticated  encryption algorithms that are suitable for disk encryp‐
1341       tion.
1342
1343

NOTES ON LOOPBACK DEVICE USE

1345       Cryptsetup is usually used directly on a block device  (disk  partition
1346       or  LVM  volume). However, if the device argument is a file, cryptsetup
1347       tries to allocate a loopback device and map it  into  this  file.  This
1348       mode  requires  Linux  kernel  2.6.25 or more recent which supports the
1349       loop autoclear flag (loop device is cleared on the last close automati‐
1350       cally). Of course, you can always map a file to a loop-device manually.
1351       See the cryptsetup FAQ for an example.
1352
1353       When device mapping is active, you can see the loop backing file in the
1354       status command output. Also see losetup(8).
1355

LUKS2 header locking

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

DEPRECATED ACTIONS

1366       The reload action is no longer supported.  Please use dmsetup(8) if you
1367       need to directly manipulate with the device mapping table.
1368
1369       The luksDelKey was replaced with luksKillSlot.
1370

REPORTING BUGS

1372       Report bugs, including ones in the  documentation,  on  the  cryptsetup
1373       mailing  list at <dm-crypt@saout.de> or in the 'Issues' section on LUKS
1374       website.  Please attach the output  of  the  failed  command  with  the
1375       --debug option added.
1376

AUTHORS

1378       cryptsetup originally written by Jana Saout <jana@saout.de>
1379       The LUKS extensions and original man page were written by Clemens Fruh‐
1380       wirth <clemens@endorphin.org>.
1381       Man page extensions by Milan Broz <gmazyland@gmail.com>.
1382       Man page rewrite and extension by Arno Wagner <arno@wagner.name>.
1383
1385       Copyright © 2004 Jana Saout
1386       Copyright © 2004-2006 Clemens Fruhwirth
1387       Copyright © 2009-2018 Red Hat, Inc.
1388       Copyright © 2009-2018 Milan Broz
1389       Copyright © 2012-2014 Arno Wagner
1390
1391       This is free software; see the source for copying conditions.  There is
1392       NO  warranty;  not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
1393       PURPOSE.
1394

SEE ALSO

1396       The LUKS website at https://gitlab.com/cryptsetup/cryptsetup/
1397
1398       The cryptsetup FAQ, contained in the distribution package and online at
1399       https://gitlab.com/cryptsetup/cryptsetup/wikis/FrequentlyAskedQuestions
1400
1401       The cryptsetup mailing list and list archive, see FAQ entry 1.6.
1402
1403       The   LUKS  on-disk  format  specification  available  at  https://git
1404       lab.com/cryptsetup/cryptsetup/wikis/Specification
1405
1406
1407
1408cryptsetup                       January 2018                    CRYPTSETUP(8)
Impressum