]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/crypttab.xml
verify: use manager_load_startable_unit_or_warn() to load units for verification
[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
5d0e4851
ZJS
221 <listitem><para>This device will not be added to <filename>cryptsetup.target</filename>.
222 This means that it will not be automatically unlocked on boot, unless something else pulls
223 it in. In particular, if the device is used for a mount point, it'll be unlocked
224 automatically during boot, unless the mount point itself is also disabled with
225 <option>noauto</option>.</para></listitem>
798d3a52
ZJS
226 </varlistentry>
227
228 <varlistentry>
229 <term><option>nofail</option></term>
230
5d0e4851
ZJS
231 <listitem><para>This device will not be a hard dependency of
232 <filename>cryptsetup.target</filename>. It'll be still pulled in and started, but the system
233 will not wait for the device to show up and be unlocked, and boot will not fail if this is
234 unsuccessful. Note that other units that depend on the unlocked device may still fail. In
235 particular, if the device is used for a mount point, the mount point itself is also needs to
236 have <option>noauto</option> option, or the boot will fail if the device is not unlocked
237 successfully.</para></listitem>
798d3a52
ZJS
238 </varlistentry>
239
ed3657d5
ZJS
240 <varlistentry>
241 <term><option>offset=</option></term>
242
243 <listitem><para>Start offset in the backend device, in 512-byte sectors. This
244 option is only relevant for plain devices.</para></listitem>
245 </varlistentry>
246
798d3a52
ZJS
247 <varlistentry>
248 <term><option>plain</option></term>
249
250 <listitem><para>Force plain encryption mode.</para></listitem>
251 </varlistentry>
252
253 <varlistentry>
254 <term><option>read-only</option></term><term><option>readonly</option></term>
255
256 <listitem><para>Set up the encrypted block device in read-only
257 mode.</para></listitem>
258 </varlistentry>
259
ed3657d5
ZJS
260 <varlistentry>
261 <term><option>skip=</option></term>
262
263 <listitem><para>How many 512-byte sectors of the encrypted data to skip at the
264 beginning. This is different from the <option>offset=</option> option with respect
265 to the sector numbers used in initialization vector (IV) calculation. Using
266 <option>offset=</option> will shift the IV calculation by the same negative
267 amount. Hence, if <option>offset=<replaceable>n</replaceable></option> is given,
268 sector <replaceable>n</replaceable> will get a sector number of 0 for the IV
269 calculation. Using <option>skip=</option> causes sector
270 <replaceable>n</replaceable> to also be the first sector of the mapped device, but
271 with its number for IV generation being <replaceable>n</replaceable>.</para>
272
273 <para>This option is only relevant for plain devices.</para>
274 </listitem>
275 </varlistentry>
276
798d3a52
ZJS
277 <varlistentry>
278 <term><option>size=</option></term>
279
280 <listitem><para>Specifies the key size in bits. See
3ba3a79d 281 <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>
798d3a52
ZJS
282 for possible values and the default value of this
283 option.</para></listitem>
284 </varlistentry>
285
286 <varlistentry>
287 <term><option>swap</option></term>
288
289 <listitem><para>The encrypted block device will be used as a
290 swap device, and will be formatted accordingly after setting
291 up the encrypted block device, with
292 <citerefentry project='man-pages'><refentrytitle>mkswap</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
293 This option implies <option>plain</option>.</para>
294
295 <para>WARNING: Using the <option>swap</option> option will
296 destroy the contents of the named partition during every boot,
297 so make sure the underlying block device is specified
298 correctly.</para></listitem>
299 </varlistentry>
300
301 <varlistentry>
302 <term><option>tcrypt</option></term>
303
304 <listitem><para>Use TrueCrypt encryption mode. When this mode
305 is used, the following options are ignored since they are
306 provided by the TrueCrypt header on the device or do not
307 apply:
308 <option>cipher=</option>,
309 <option>hash=</option>,
310 <option>keyfile-offset=</option>,
311 <option>keyfile-size=</option>,
312 <option>size=</option>.</para>
313
314 <para>When this mode is used, the passphrase is read from the
315 key file given in the third field. Only the first line of this
316 file is read, excluding the new line character.</para>
317
318 <para>Note that the TrueCrypt format uses both passphrase and
319 key files to derive a password for the volume. Therefore, the
320 passphrase and all key files need to be provided. Use
321 <option>tcrypt-keyfile=</option> to provide the absolute path
322 to all key files. When using an empty passphrase in
323 combination with one or more key files, use
324 <literal>/dev/null</literal> as the password file in the third
325 field.</para></listitem>
326 </varlistentry>
327
328 <varlistentry>
329 <term><option>tcrypt-hidden</option></term>
330
331 <listitem><para>Use the hidden TrueCrypt volume. This option
332 implies <option>tcrypt</option>.</para>
333
334 <para>This will map the hidden volume that is inside of the
335 volume provided in the second field. Please note that there is
336 no protection for the hidden volume if the outer volume is
337 mounted instead. See
3ba3a79d 338 <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>
798d3a52
ZJS
339 for more information on this limitation.</para></listitem>
340 </varlistentry>
341
342 <varlistentry>
343 <term><option>tcrypt-keyfile=</option></term>
344
345 <listitem><para>Specifies the absolute path to a key file to
346 use for a TrueCrypt volume. This implies
347 <option>tcrypt</option> and can be used more than once to
348 provide several key files.</para>
349
350 <para>See the entry for <option>tcrypt</option> on the
351 behavior of the passphrase and key files when using TrueCrypt
352 encryption mode.</para></listitem>
353 </varlistentry>
354
355 <varlistentry>
356 <term><option>tcrypt-system</option></term>
357
358 <listitem><para>Use TrueCrypt in system encryption mode. This
359 option implies <option>tcrypt</option>.</para></listitem>
360 </varlistentry>
361
52028838
GH
362 <varlistentry>
363 <term><option>tcrypt-veracrypt</option></term>
364
365 <listitem><para>Check for a VeraCrypt volume. VeraCrypt is a fork of
366 TrueCrypt that is mostly compatible, but uses different, stronger key
367 derivation algorithms that cannot be detected without this flag.
368 Enabling this option could substantially slow down unlocking, because
369 VeraCrypt's key derivation takes much longer than TrueCrypt's. This
370 option implies <option>tcrypt</option>.</para></listitem>
371 </varlistentry>
372
798d3a52
ZJS
373 <varlistentry>
374 <term><option>timeout=</option></term>
375
376 <listitem><para>Specifies the timeout for querying for a
377 password. If no unit is specified, seconds is used. Supported
378 units are s, ms, us, min, h, d. A timeout of 0 waits
379 indefinitely (which is the default).</para></listitem>
380 </varlistentry>
381
798d3a52
ZJS
382 <varlistentry>
383 <term><option>tmp</option></term>
384
385 <listitem><para>The encrypted block device will be prepared
386 for using it as <filename>/tmp</filename>; it will be
387 formatted using
388 <citerefentry project='man-pages'><refentrytitle>mke2fs</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
389 This option implies <option>plain</option>.</para>
390
391 <para>WARNING: Using the <option>tmp</option> option will
392 destroy the contents of the named partition during every boot,
393 so make sure the underlying block device is specified
394 correctly.</para></listitem>
395 </varlistentry>
396
397 <varlistentry>
398 <term><option>tries=</option></term>
399
400 <listitem><para>Specifies the maximum number of times the user
401 is queried for a password. The default is 3. If set to 0, the
402 user is queried for a password indefinitely.</para></listitem>
403 </varlistentry>
404
405 <varlistentry>
406 <term><option>verify</option></term>
407
408 <listitem><para> If the encryption password is read from
409 console, it has to be entered twice to prevent
410 typos.</para></listitem>
411 </varlistentry>
412
ed3657d5
ZJS
413 <varlistentry>
414 <term><option>x-systemd.device-timeout=</option></term>
415
416 <listitem><para>Specifies how long systemd should wait for a device to show up
417 before giving up on the entry. The argument is a time in seconds or explicitly
418 specified units of
419 <literal>s</literal>,
420 <literal>min</literal>,
421 <literal>h</literal>,
422 <literal>ms</literal>.
423 </para></listitem>
424 </varlistentry>
425
798d3a52
ZJS
426 </variablelist>
427
428 <para>At early boot and when the system manager configuration is
429 reloaded, this file is translated into native systemd units by
430 <citerefentry><refentrytitle>systemd-cryptsetup-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
431 </refsect1>
432
433 <refsect1>
434 <title>Example</title>
435 <example>
436 <title>/etc/crypttab example</title>
437 <para>Set up four encrypted block devices. One using LUKS for
438 normal storage, another one for usage as a swap device and two
439 TrueCrypt volumes.</para>
440
441 <programlisting>luks UUID=2505567a-9e27-4efe-a4d5-15ad146c258b
442swap /dev/sda7 /dev/urandom swap
8cf3ca80 443truecrypt /dev/sda2 /etc/container_password tcrypt
798d3a52
ZJS
444hidden /mnt/tc_hidden /dev/null tcrypt-hidden,tcrypt-keyfile=/etc/keyfile</programlisting>
445 </example>
446 </refsect1>
447
448 <refsect1>
449 <title>See Also</title>
450 <para>
451 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
452 <citerefentry><refentrytitle>systemd-cryptsetup@.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
453 <citerefentry><refentrytitle>systemd-cryptsetup-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
288c2616 454 <citerefentry project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
3ba3a79d 455 <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
798d3a52
ZJS
456 <citerefentry project='man-pages'><refentrytitle>mkswap</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
457 <citerefentry project='man-pages'><refentrytitle>mke2fs</refentrytitle><manvolnum>8</manvolnum></citerefentry>
458 </para>
459 </refsect1>
45ae1a05
LP
460
461</refentry>