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