3 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
5 This file is part of systemd.
7 Copyright 2012 Lennart Poettering
9 systemd is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation; either version 2.1 of the License, or
12 (at your option) any later version.
14 systemd is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
19 You should have received a copy of the GNU Lesser General Public License
20 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 This is based on crypttab(5) from Fedora's initscripts package, which in
23 turn is based on Debian's version.
25 The Red Hat version has been written by Miloslav Trmac <mitr@redhat.com>.
28 <refentry id="crypttab" conditional='HAVE_LIBCRYPTSETUP'>
31 <title>crypttab</title>
32 <productname>systemd</productname>
36 <contrib>Documentation</contrib>
37 <firstname>Miloslav</firstname>
38 <surname>Trmac</surname>
39 <email>mitr@redhat.com</email>
42 <contrib>Documentation</contrib>
43 <firstname>Lennart</firstname>
44 <surname>Poettering</surname>
45 <email>lennart@poettering.net</email>
51 <refentrytitle>crypttab</refentrytitle>
52 <manvolnum>5</manvolnum>
56 <refname>crypttab</refname>
57 <refpurpose>Configuration for encrypted block devices</refpurpose>
61 <para><filename>/etc/crypttab</filename></para>
65 <title>Description</title>
67 <para>The <filename>/etc/crypttab</filename> file describes
68 encrypted block devices that are set up during system boot.</para>
70 <para>Empty lines and lines starting with the <literal>#</literal>
71 character are ignored. Each of the remaining lines describes one
72 encrypted block device, fields on the line are delimited by white
73 space. The first two fields are mandatory, the remaining two are
76 <para>Setting up encrypted block devices using this file supports
77 three encryption modes: LUKS, TrueCrypt and plain. See
78 <citerefentry><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>
79 for more information about each mode. When no mode is specified in
80 the options field and the block device contains a LUKS signature,
81 it is opened as a LUKS device; otherwise, it is assumed to be in
82 raw dm-crypt (plain mode) format.</para>
84 <para>The first field contains the name of the resulting encrypted
85 block device; the device is set up within
86 <filename>/dev/mapper/</filename>.</para>
88 <para>The second field contains a path to the underlying block
89 device or file, or a specification of a block device via
90 <literal>UUID=</literal> followed by the UUID.</para>
92 <para>The third field specifies the encryption password. If the
93 field is not present or the password is set to
94 <literal>none</literal> or <literal>-</literal>, the password has
95 to be manually entered during system boot. Otherwise, the field is
96 interpreted as a absolute path to a file containing the encryption
97 password. For swap encryption, <filename>/dev/urandom</filename>
98 or the hardware device <filename>/dev/hw_random</filename> can be
99 used as the password file; using <filename>/dev/random</filename>
100 may prevent boot completion if the system does not have enough
101 entropy to generate a truly random encryption key.</para>
103 <para>The fourth field, if present, is a comma-delimited list of
104 options. The following options are recognized:</para>
106 <variablelist class='fstab-options'>
109 <term><option>discard</option></term>
111 <listitem><para>Allow discard requests to be passed through
112 the encrypted block device. This improves performance on SSD
113 storage but has security implications.</para></listitem>
117 <term><option>cipher=</option></term>
119 <listitem><para>Specifies the cipher to use. See
120 <citerefentry><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>
121 for possible values and the default value of this option. A
122 cipher with unpredictable IV values, such as
123 <literal>aes-cbc-essiv:sha256</literal>, is
124 recommended.</para></listitem>
128 <term><option>hash=</option></term>
130 <listitem><para>Specifies the hash to use for password
132 <citerefentry><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>
133 for possible values and the default value of this
134 option.</para></listitem>
138 <term><option>header=</option></term>
140 <listitem><para>Use a detached (separated) metadata device or
141 file where the LUKS header is stored. This option is only
142 relevant for LUKS devices. See
143 <citerefentry><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>
144 for possible values and the default value of this
145 option.</para></listitem>
149 <term><option>keyfile-offset=</option></term>
151 <listitem><para>Specifies the number of bytes to skip at the
152 start of the key file. See
153 <citerefentry><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>
154 for possible values and the default value of this
155 option.</para></listitem>
159 <term><option>keyfile-size=</option></term>
161 <listitem><para>Specifies the maximum number of bytes to read
162 from the key file. See
163 <citerefentry><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>
164 for possible values and the default value of this option. This
165 option is ignored in plain encryption mode, as the key file
166 size is then given by the key size.</para></listitem>
170 <term><option>key-slot=</option></term>
172 <listitem><para>Specifies the key slot to compare the
173 passphrase or key against. If the key slot does not match the
174 given passphrase or key, but another would, the setup of the
175 device will fail regardless. This option implies
176 <option>luks</option>. See
177 <citerefentry><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>
178 for possible values. The default is to try all key slots in
179 sequential order.</para></listitem>
183 <term><option>luks</option></term>
185 <listitem><para>Force LUKS mode. When this mode is used, the
186 following options are ignored since they are provided by the
187 LUKS header on the device: <option>cipher=</option>,
188 <option>hash=</option>,
189 <option>size=</option>.</para></listitem>
193 <term><option>noauto</option></term>
195 <listitem><para>This device will not be automatically unlocked
196 on boot.</para></listitem>
200 <term><option>nofail</option></term>
202 <listitem><para>The system will not wait for the device to
203 show up and be unlocked at boot, and not fail the boot if it
204 does not show up.</para></listitem>
208 <term><option>plain</option></term>
210 <listitem><para>Force plain encryption mode.</para></listitem>
214 <term><option>read-only</option></term><term><option>readonly</option></term>
216 <listitem><para>Set up the encrypted block device in read-only
217 mode.</para></listitem>
221 <term><option>size=</option></term>
223 <listitem><para>Specifies the key size in bits. See
224 <citerefentry><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>
225 for possible values and the default value of this
226 option.</para></listitem>
230 <term><option>swap</option></term>
232 <listitem><para>The encrypted block device will be used as a
233 swap device, and will be formatted accordingly after setting
234 up the encrypted block device, with
235 <citerefentry project='man-pages'><refentrytitle>mkswap</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
236 This option implies <option>plain</option>.</para>
238 <para>WARNING: Using the <option>swap</option> option will
239 destroy the contents of the named partition during every boot,
240 so make sure the underlying block device is specified
241 correctly.</para></listitem>
245 <term><option>tcrypt</option></term>
247 <listitem><para>Use TrueCrypt encryption mode. When this mode
248 is used, the following options are ignored since they are
249 provided by the TrueCrypt header on the device or do not
251 <option>cipher=</option>,
252 <option>hash=</option>,
253 <option>keyfile-offset=</option>,
254 <option>keyfile-size=</option>,
255 <option>size=</option>.</para>
257 <para>When this mode is used, the passphrase is read from the
258 key file given in the third field. Only the first line of this
259 file is read, excluding the new line character.</para>
261 <para>Note that the TrueCrypt format uses both passphrase and
262 key files to derive a password for the volume. Therefore, the
263 passphrase and all key files need to be provided. Use
264 <option>tcrypt-keyfile=</option> to provide the absolute path
265 to all key files. When using an empty passphrase in
266 combination with one or more key files, use
267 <literal>/dev/null</literal> as the password file in the third
268 field.</para></listitem>
272 <term><option>tcrypt-hidden</option></term>
274 <listitem><para>Use the hidden TrueCrypt volume. This option
275 implies <option>tcrypt</option>.</para>
277 <para>This will map the hidden volume that is inside of the
278 volume provided in the second field. Please note that there is
279 no protection for the hidden volume if the outer volume is
281 <citerefentry><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>
282 for more information on this limitation.</para></listitem>
286 <term><option>tcrypt-keyfile=</option></term>
288 <listitem><para>Specifies the absolute path to a key file to
289 use for a TrueCrypt volume. This implies
290 <option>tcrypt</option> and can be used more than once to
291 provide several key files.</para>
293 <para>See the entry for <option>tcrypt</option> on the
294 behavior of the passphrase and key files when using TrueCrypt
295 encryption mode.</para></listitem>
299 <term><option>tcrypt-system</option></term>
301 <listitem><para>Use TrueCrypt in system encryption mode. This
302 option implies <option>tcrypt</option>.</para></listitem>
306 <term><option>timeout=</option></term>
308 <listitem><para>Specifies the timeout for querying for a
309 password. If no unit is specified, seconds is used. Supported
310 units are s, ms, us, min, h, d. A timeout of 0 waits
311 indefinitely (which is the default).</para></listitem>
315 <term><option>x-systemd.device-timeout=</option></term>
317 <listitem><para>Specifies how long systemd should wait for a
318 device to show up before giving up on the entry. The argument
319 is a time in seconds or explicitly specified units of
320 <literal>s</literal>,
321 <literal>min</literal>,
322 <literal>h</literal>,
323 <literal>ms</literal>.
328 <term><option>tmp</option></term>
330 <listitem><para>The encrypted block device will be prepared
331 for using it as <filename>/tmp</filename>; it will be
333 <citerefentry project='man-pages'><refentrytitle>mke2fs</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
334 This option implies <option>plain</option>.</para>
336 <para>WARNING: Using the <option>tmp</option> option will
337 destroy the contents of the named partition during every boot,
338 so make sure the underlying block device is specified
339 correctly.</para></listitem>
343 <term><option>tries=</option></term>
345 <listitem><para>Specifies the maximum number of times the user
346 is queried for a password. The default is 3. If set to 0, the
347 user is queried for a password indefinitely.</para></listitem>
351 <term><option>verify</option></term>
353 <listitem><para> If the encryption password is read from
354 console, it has to be entered twice to prevent
355 typos.</para></listitem>
360 <para>At early boot and when the system manager configuration is
361 reloaded, this file is translated into native systemd units by
362 <citerefentry><refentrytitle>systemd-cryptsetup-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
366 <title>Example</title>
368 <title>/etc/crypttab example</title>
369 <para>Set up four encrypted block devices. One using LUKS for
370 normal storage, another one for usage as a swap device and two
371 TrueCrypt volumes.</para>
373 <programlisting>luks UUID=2505567a-9e27-4efe-a4d5-15ad146c258b
374 swap /dev/sda7 /dev/urandom swap
375 truecrypt /dev/sda2 /etc/container_password tcrypt
376 hidden /mnt/tc_hidden /dev/null tcrypt-hidden,tcrypt-keyfile=/etc/keyfile</programlisting>
381 <title>See Also</title>
383 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
384 <citerefentry><refentrytitle>systemd-cryptsetup@.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
385 <citerefentry><refentrytitle>systemd-cryptsetup-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
386 <citerefentry><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
387 <citerefentry project='man-pages'><refentrytitle>mkswap</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
388 <citerefentry project='man-pages'><refentrytitle>mke2fs</refentrytitle><manvolnum>8</manvolnum></citerefentry>