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