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