]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/crypttab.xml
tree-wide: drop license boilerplate
[thirdparty/systemd.git] / man / crypttab.xml
CommitLineData
45ae1a05
LP
1<?xml version="1.0"?>
2<!--*-nxml-*-->
12b42c76 3<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
45ae1a05 4<!--
572eb058
ZJS
5 SPDX-License-Identifier: LGPL-2.1+
6
45ae1a05
LP
7 This file is part of systemd.
8
9 Copyright 2012 Lennart Poettering
10
45ae1a05
LP
11 This is based on crypttab(5) from Fedora's initscripts package, which in
12 turn is based on Debian's version.
13
14 The Red Hat version has been written by Miloslav Trmac <mitr@redhat.com>.
15
16-->
56ba3c78 17<refentry id="crypttab" conditional='HAVE_LIBCRYPTSETUP'>
45ae1a05 18
798d3a52
ZJS
19 <refentryinfo>
20 <title>crypttab</title>
21 <productname>systemd</productname>
22
23 <authorgroup>
24 <author>
25 <contrib>Documentation</contrib>
26 <firstname>Miloslav</firstname>
27 <surname>Trmac</surname>
28 <email>mitr@redhat.com</email>
29 </author>
30 <author>
31 <contrib>Documentation</contrib>
32 <firstname>Lennart</firstname>
33 <surname>Poettering</surname>
34 <email>lennart@poettering.net</email>
35 </author>
36 </authorgroup>
37 </refentryinfo>
38
39 <refmeta>
40 <refentrytitle>crypttab</refentrytitle>
41 <manvolnum>5</manvolnum>
42 </refmeta>
43
44 <refnamediv>
45 <refname>crypttab</refname>
46 <refpurpose>Configuration for encrypted block devices</refpurpose>
47 </refnamediv>
48
49 <refsynopsisdiv>
50 <para><filename>/etc/crypttab</filename></para>
51 </refsynopsisdiv>
52
53 <refsect1>
54 <title>Description</title>
55
56 <para>The <filename>/etc/crypttab</filename> file describes
57 encrypted block devices that are set up during system boot.</para>
58
59 <para>Empty lines and lines starting with the <literal>#</literal>
60 character are ignored. Each of the remaining lines describes one
ed3657d5 61 encrypted block device. Fields are delimited by white space.</para>
b2a1a5c7
ZJS
62
63 <para>Each line is in the form<programlisting><replaceable>name</replaceable> <replaceable>encrypted-device</replaceable> <replaceable>password</replaceable> <replaceable>options</replaceable></programlisting>
64 The first two fields are mandatory, the remaining two are
798d3a52
ZJS
65 optional.</para>
66
67 <para>Setting up encrypted block devices using this file supports
68 three encryption modes: LUKS, TrueCrypt and plain. See
3ba3a79d 69 <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>
798d3a52
ZJS
70 for more information about each mode. When no mode is specified in
71 the options field and the block device contains a LUKS signature,
72 it is opened as a LUKS device; otherwise, it is assumed to be in
73 raw dm-crypt (plain mode) format.</para>
74
75 <para>The first field contains the name of the resulting encrypted
76 block device; the device is set up within
77 <filename>/dev/mapper/</filename>.</para>
78
79 <para>The second field contains a path to the underlying block
80 device or file, or a specification of a block device via
81 <literal>UUID=</literal> followed by the UUID.</para>
82
83 <para>The third field specifies the encryption password. If the
84 field is not present or the password is set to
85 <literal>none</literal> or <literal>-</literal>, the password has
86 to be manually entered during system boot. Otherwise, the field is
037a3ded 87 interpreted as an absolute path to a file containing the encryption
798d3a52
ZJS
88 password. For swap encryption, <filename>/dev/urandom</filename>
89 or the hardware device <filename>/dev/hw_random</filename> can be
90 used as the password file; using <filename>/dev/random</filename>
91 may prevent boot completion if the system does not have enough
92 entropy to generate a truly random encryption key.</para>
93
94 <para>The fourth field, if present, is a comma-delimited list of
95 options. The following options are recognized:</para>
96
97 <variablelist class='fstab-options'>
98
798d3a52
ZJS
99 <varlistentry>
100 <term><option>cipher=</option></term>
101
102 <listitem><para>Specifies the cipher to use. See
3ba3a79d 103 <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>
798d3a52
ZJS
104 for possible values and the default value of this option. A
105 cipher with unpredictable IV values, such as
106 <literal>aes-cbc-essiv:sha256</literal>, is
107 recommended.</para></listitem>
108 </varlistentry>
109
ed3657d5
ZJS
110 <varlistentry>
111 <term><option>discard</option></term>
112
113 <listitem><para>Allow discard requests to be passed through the encrypted block
114 device. This improves performance on SSD storage but has security implications.
115 </para></listitem>
116 </varlistentry>
117
798d3a52
ZJS
118 <varlistentry>
119 <term><option>hash=</option></term>
120
121 <listitem><para>Specifies the hash to use for password
122 hashing. See
3ba3a79d 123 <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>
798d3a52
ZJS
124 for possible values and the default value of this
125 option.</para></listitem>
126 </varlistentry>
127
128 <varlistentry>
129 <term><option>header=</option></term>
130
131 <listitem><para>Use a detached (separated) metadata device or
132 file where the LUKS header is stored. This option is only
133 relevant for LUKS devices. See
3ba3a79d 134 <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>
798d3a52
ZJS
135 for possible values and the default value of this
136 option.</para></listitem>
137 </varlistentry>
138
139 <varlistentry>
140 <term><option>keyfile-offset=</option></term>
141
142 <listitem><para>Specifies the number of bytes to skip at the
143 start of the key file. See
3ba3a79d 144 <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>
798d3a52
ZJS
145 for possible values and the default value of this
146 option.</para></listitem>
147 </varlistentry>
148
149 <varlistentry>
150 <term><option>keyfile-size=</option></term>
151
152 <listitem><para>Specifies the maximum number of bytes to read
153 from the key file. See
3ba3a79d 154 <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>
798d3a52
ZJS
155 for possible values and the default value of this option. This
156 option is ignored in plain encryption mode, as the key file
157 size is then given by the key size.</para></listitem>
158 </varlistentry>
159
160 <varlistentry>
161 <term><option>key-slot=</option></term>
162
163 <listitem><para>Specifies the key slot to compare the
164 passphrase or key against. If the key slot does not match the
165 given passphrase or key, but another would, the setup of the
166 device will fail regardless. This option implies
167 <option>luks</option>. See
3ba3a79d 168 <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>
798d3a52
ZJS
169 for possible values. The default is to try all key slots in
170 sequential order.</para></listitem>
171 </varlistentry>
172
173 <varlistentry>
174 <term><option>luks</option></term>
175
176 <listitem><para>Force LUKS mode. When this mode is used, the
177 following options are ignored since they are provided by the
178 LUKS header on the device: <option>cipher=</option>,
179 <option>hash=</option>,
180 <option>size=</option>.</para></listitem>
181 </varlistentry>
182
b001ad61
ZJS
183 <varlistentry>
184 <term><option>_netdev</option></term>
185
186 <listitem><para>Marks this cryptsetup device as requiring network. It will be
187 started after the network is available, similarly to
188 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
189 units marked with <option>_netdev</option>. The service unit to set up this device
a0dd2097 190 will be ordered between <filename>remote-fs-pre.target</filename> and
b001ad61
ZJS
191 <filename>remote-cryptsetup.target</filename>, instead of
192 <filename>cryptsetup-pre.target</filename> and
288c2616
ZJS
193 <filename>cryptsetup.target</filename>.</para>
194
195 <para>Hint: if this device is used for a mount point that is specified in
196 <citerefentry project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
197 the <option>_netdev</option> option should also be used for the mount
198 point. Otherwise, a dependency loop might be created where the mount point
199 will be pulled in by <filename>local-fs.target</filename>, while the
200 service to configure the network is usually only started <emphasis>after</emphasis>
201 the local file system has been mounted.</para>
202 </listitem>
b001ad61
ZJS
203 </varlistentry>
204
798d3a52
ZJS
205 <varlistentry>
206 <term><option>noauto</option></term>
207
5d0e4851
ZJS
208 <listitem><para>This device will not be added to <filename>cryptsetup.target</filename>.
209 This means that it will not be automatically unlocked on boot, unless something else pulls
210 it in. In particular, if the device is used for a mount point, it'll be unlocked
211 automatically during boot, unless the mount point itself is also disabled with
212 <option>noauto</option>.</para></listitem>
798d3a52
ZJS
213 </varlistentry>
214
215 <varlistentry>
216 <term><option>nofail</option></term>
217
5d0e4851
ZJS
218 <listitem><para>This device will not be a hard dependency of
219 <filename>cryptsetup.target</filename>. It'll be still pulled in and started, but the system
220 will not wait for the device to show up and be unlocked, and boot will not fail if this is
221 unsuccessful. Note that other units that depend on the unlocked device may still fail. In
222 particular, if the device is used for a mount point, the mount point itself is also needs to
223 have <option>noauto</option> option, or the boot will fail if the device is not unlocked
224 successfully.</para></listitem>
798d3a52
ZJS
225 </varlistentry>
226
ed3657d5
ZJS
227 <varlistentry>
228 <term><option>offset=</option></term>
229
230 <listitem><para>Start offset in the backend device, in 512-byte sectors. This
231 option is only relevant for plain devices.</para></listitem>
232 </varlistentry>
233
798d3a52
ZJS
234 <varlistentry>
235 <term><option>plain</option></term>
236
237 <listitem><para>Force plain encryption mode.</para></listitem>
238 </varlistentry>
239
240 <varlistentry>
241 <term><option>read-only</option></term><term><option>readonly</option></term>
242
243 <listitem><para>Set up the encrypted block device in read-only
244 mode.</para></listitem>
245 </varlistentry>
246
ed3657d5
ZJS
247 <varlistentry>
248 <term><option>skip=</option></term>
249
250 <listitem><para>How many 512-byte sectors of the encrypted data to skip at the
251 beginning. This is different from the <option>offset=</option> option with respect
252 to the sector numbers used in initialization vector (IV) calculation. Using
253 <option>offset=</option> will shift the IV calculation by the same negative
254 amount. Hence, if <option>offset=<replaceable>n</replaceable></option> is given,
255 sector <replaceable>n</replaceable> will get a sector number of 0 for the IV
256 calculation. Using <option>skip=</option> causes sector
257 <replaceable>n</replaceable> to also be the first sector of the mapped device, but
258 with its number for IV generation being <replaceable>n</replaceable>.</para>
259
260 <para>This option is only relevant for plain devices.</para>
261 </listitem>
262 </varlistentry>
263
798d3a52
ZJS
264 <varlistentry>
265 <term><option>size=</option></term>
266
267 <listitem><para>Specifies the key size in bits. See
3ba3a79d 268 <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>
798d3a52
ZJS
269 for possible values and the default value of this
270 option.</para></listitem>
271 </varlistentry>
272
273 <varlistentry>
274 <term><option>swap</option></term>
275
276 <listitem><para>The encrypted block device will be used as a
277 swap device, and will be formatted accordingly after setting
278 up the encrypted block device, with
279 <citerefentry project='man-pages'><refentrytitle>mkswap</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
280 This option implies <option>plain</option>.</para>
281
282 <para>WARNING: Using the <option>swap</option> option will
283 destroy the contents of the named partition during every boot,
284 so make sure the underlying block device is specified
285 correctly.</para></listitem>
286 </varlistentry>
287
288 <varlistentry>
289 <term><option>tcrypt</option></term>
290
291 <listitem><para>Use TrueCrypt encryption mode. When this mode
292 is used, the following options are ignored since they are
293 provided by the TrueCrypt header on the device or do not
294 apply:
295 <option>cipher=</option>,
296 <option>hash=</option>,
297 <option>keyfile-offset=</option>,
298 <option>keyfile-size=</option>,
299 <option>size=</option>.</para>
300
301 <para>When this mode is used, the passphrase is read from the
302 key file given in the third field. Only the first line of this
303 file is read, excluding the new line character.</para>
304
305 <para>Note that the TrueCrypt format uses both passphrase and
306 key files to derive a password for the volume. Therefore, the
307 passphrase and all key files need to be provided. Use
308 <option>tcrypt-keyfile=</option> to provide the absolute path
309 to all key files. When using an empty passphrase in
310 combination with one or more key files, use
311 <literal>/dev/null</literal> as the password file in the third
312 field.</para></listitem>
313 </varlistentry>
314
315 <varlistentry>
316 <term><option>tcrypt-hidden</option></term>
317
318 <listitem><para>Use the hidden TrueCrypt volume. This option
319 implies <option>tcrypt</option>.</para>
320
321 <para>This will map the hidden volume that is inside of the
322 volume provided in the second field. Please note that there is
323 no protection for the hidden volume if the outer volume is
324 mounted instead. See
3ba3a79d 325 <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>
798d3a52
ZJS
326 for more information on this limitation.</para></listitem>
327 </varlistentry>
328
329 <varlistentry>
330 <term><option>tcrypt-keyfile=</option></term>
331
332 <listitem><para>Specifies the absolute path to a key file to
333 use for a TrueCrypt volume. This implies
334 <option>tcrypt</option> and can be used more than once to
335 provide several key files.</para>
336
337 <para>See the entry for <option>tcrypt</option> on the
338 behavior of the passphrase and key files when using TrueCrypt
339 encryption mode.</para></listitem>
340 </varlistentry>
341
342 <varlistentry>
343 <term><option>tcrypt-system</option></term>
344
345 <listitem><para>Use TrueCrypt in system encryption mode. This
346 option implies <option>tcrypt</option>.</para></listitem>
347 </varlistentry>
348
52028838
GH
349 <varlistentry>
350 <term><option>tcrypt-veracrypt</option></term>
351
352 <listitem><para>Check for a VeraCrypt volume. VeraCrypt is a fork of
353 TrueCrypt that is mostly compatible, but uses different, stronger key
354 derivation algorithms that cannot be detected without this flag.
355 Enabling this option could substantially slow down unlocking, because
356 VeraCrypt's key derivation takes much longer than TrueCrypt's. This
357 option implies <option>tcrypt</option>.</para></listitem>
358 </varlistentry>
359
798d3a52
ZJS
360 <varlistentry>
361 <term><option>timeout=</option></term>
362
363 <listitem><para>Specifies the timeout for querying for a
364 password. If no unit is specified, seconds is used. Supported
365 units are s, ms, us, min, h, d. A timeout of 0 waits
366 indefinitely (which is the default).</para></listitem>
367 </varlistentry>
368
798d3a52
ZJS
369 <varlistentry>
370 <term><option>tmp</option></term>
371
372 <listitem><para>The encrypted block device will be prepared
373 for using it as <filename>/tmp</filename>; it will be
374 formatted using
375 <citerefentry project='man-pages'><refentrytitle>mke2fs</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
376 This option implies <option>plain</option>.</para>
377
378 <para>WARNING: Using the <option>tmp</option> option will
379 destroy the contents of the named partition during every boot,
380 so make sure the underlying block device is specified
381 correctly.</para></listitem>
382 </varlistentry>
383
384 <varlistentry>
385 <term><option>tries=</option></term>
386
387 <listitem><para>Specifies the maximum number of times the user
388 is queried for a password. The default is 3. If set to 0, the
389 user is queried for a password indefinitely.</para></listitem>
390 </varlistentry>
391
392 <varlistentry>
393 <term><option>verify</option></term>
394
395 <listitem><para> If the encryption password is read from
396 console, it has to be entered twice to prevent
397 typos.</para></listitem>
398 </varlistentry>
399
ed3657d5
ZJS
400 <varlistentry>
401 <term><option>x-systemd.device-timeout=</option></term>
402
403 <listitem><para>Specifies how long systemd should wait for a device to show up
404 before giving up on the entry. The argument is a time in seconds or explicitly
405 specified units of
406 <literal>s</literal>,
407 <literal>min</literal>,
408 <literal>h</literal>,
409 <literal>ms</literal>.
410 </para></listitem>
411 </varlistentry>
412
798d3a52
ZJS
413 </variablelist>
414
415 <para>At early boot and when the system manager configuration is
416 reloaded, this file is translated into native systemd units by
417 <citerefentry><refentrytitle>systemd-cryptsetup-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
418 </refsect1>
419
420 <refsect1>
421 <title>Example</title>
422 <example>
423 <title>/etc/crypttab example</title>
424 <para>Set up four encrypted block devices. One using LUKS for
425 normal storage, another one for usage as a swap device and two
426 TrueCrypt volumes.</para>
427
428 <programlisting>luks UUID=2505567a-9e27-4efe-a4d5-15ad146c258b
429swap /dev/sda7 /dev/urandom swap
8cf3ca80 430truecrypt /dev/sda2 /etc/container_password tcrypt
798d3a52
ZJS
431hidden /mnt/tc_hidden /dev/null tcrypt-hidden,tcrypt-keyfile=/etc/keyfile</programlisting>
432 </example>
433 </refsect1>
434
435 <refsect1>
436 <title>See Also</title>
437 <para>
438 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
439 <citerefentry><refentrytitle>systemd-cryptsetup@.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
440 <citerefentry><refentrytitle>systemd-cryptsetup-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
288c2616 441 <citerefentry project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
3ba3a79d 442 <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
798d3a52
ZJS
443 <citerefentry project='man-pages'><refentrytitle>mkswap</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
444 <citerefentry project='man-pages'><refentrytitle>mke2fs</refentrytitle><manvolnum>8</manvolnum></citerefentry>
445 </para>
446 </refsect1>
45ae1a05
LP
447
448</refentry>