1CRYPTTAB(5) crypttab CRYPTTAB(5)
2
3
4
6 crypttab - Configuration for encrypted block devices
7
9 /etc/crypttab
10
12 The /etc/crypttab file describes encrypted block devices that are set
13 up during system boot.
14
15 Empty lines and lines starting with the "#" character are ignored. Each
16 of the remaining lines describes one encrypted block device. Fields are
17 delimited by white space.
18
19 Each line is in the form
20
21 name encrypted-device password options
22
23 The first two fields are mandatory, the remaining two are optional.
24
25 Setting up encrypted block devices using this file supports three
26 encryption modes: LUKS, TrueCrypt and plain. See cryptsetup(8) for more
27 information about each mode. When no mode is specified in the options
28 field and the block device contains a LUKS signature, it is opened as a
29 LUKS device; otherwise, it is assumed to be in raw dm-crypt (plain
30 mode) format.
31
32 The first field contains the name of the resulting encrypted block
33 device; the device is set up within /dev/mapper/.
34
35 The second field contains a path to the underlying block device or
36 file, or a specification of a block device via "UUID=" followed by the
37 UUID.
38
39 The third field specifies the encryption password. If the field is not
40 present or the password is set to "none" or "-", the password has to be
41 manually entered during system boot. Otherwise, the field is
42 interpreted as an absolute path to a file containing the encryption
43 password. For swap encryption, /dev/urandom or the hardware device
44 /dev/hw_random can be used as the password file; using /dev/random may
45 prevent boot completion if the system does not have enough entropy to
46 generate a truly random encryption key.
47
48 The fourth field, if present, is a comma-delimited list of options. The
49 following options are recognized:
50
51 cipher=
52 Specifies the cipher to use. See cryptsetup(8) for possible values
53 and the default value of this option. A cipher with unpredictable
54 IV values, such as "aes-cbc-essiv:sha256", is recommended.
55
56 discard
57 Allow discard requests to be passed through the encrypted block
58 device. This improves performance on SSD storage but has security
59 implications.
60
61 hash=
62 Specifies the hash to use for password hashing. See cryptsetup(8)
63 for possible values and the default value of this option.
64
65 header=
66 Use a detached (separated) metadata device or file where the LUKS
67 header is stored. This option is only relevant for LUKS devices.
68 See cryptsetup(8) for possible values and the default value of this
69 option.
70
71 keyfile-offset=
72 Specifies the number of bytes to skip at the start of the key file.
73 See cryptsetup(8) for possible values and the default value of this
74 option.
75
76 keyfile-size=
77 Specifies the maximum number of bytes to read from the key file.
78 See cryptsetup(8) for possible values and the default value of this
79 option. This option is ignored in plain encryption mode, as the key
80 file size is then given by the key size.
81
82 key-slot=
83 Specifies the key slot to compare the passphrase or key against. If
84 the key slot does not match the given passphrase or key, but
85 another would, the setup of the device will fail regardless. This
86 option implies luks. See cryptsetup(8) for possible values. The
87 default is to try all key slots in sequential order.
88
89 keyfile-timeout=
90 Specifies the timeout for the device on which the key file resides
91 and falls back to a password if it could not be mounted. See
92 systemd-cryptsetup-generator(8) for key files on external devices.
93
94 luks
95 Force LUKS mode. When this mode is used, the following options are
96 ignored since they are provided by the LUKS header on the device:
97 cipher=, hash=, size=.
98
99 _netdev
100 Marks this cryptsetup device as requiring network. It will be
101 started after the network is available, similarly to
102 systemd.mount(5) units marked with _netdev. The service unit to set
103 up this device will be ordered between remote-fs-pre.target and
104 remote-cryptsetup.target, instead of cryptsetup-pre.target and
105 cryptsetup.target.
106
107 Hint: if this device is used for a mount point that is specified in
108 fstab(5), the _netdev option should also be used for the mount
109 point. Otherwise, a dependency loop might be created where the
110 mount point will be pulled in by local-fs.target, while the service
111 to configure the network is usually only started after the local
112 file system has been mounted.
113
114 noauto
115 This device will not be added to cryptsetup.target. This means that
116 it will not be automatically unlocked on boot, unless something
117 else pulls it in. In particular, if the device is used for a mount
118 point, it'll be unlocked automatically during boot, unless the
119 mount point itself is also disabled with noauto.
120
121 nofail
122 This device will not be a hard dependency of cryptsetup.target.
123 It'll still be pulled in and started, but the system will not wait
124 for the device to show up and be unlocked, and boot will not fail
125 if this is unsuccessful. Note that other units that depend on the
126 unlocked device may still fail. In particular, if the device is
127 used for a mount point, the mount point itself also needs to have
128 the nofail option, or the boot will fail if the device is not
129 unlocked successfully.
130
131 offset=
132 Start offset in the backend device, in 512-byte sectors. This
133 option is only relevant for plain devices.
134
135 plain
136 Force plain encryption mode.
137
138 read-only, readonly
139 Set up the encrypted block device in read-only mode.
140
141 same-cpu-crypt
142 Perform encryption using the same cpu that IO was submitted on. The
143 default is to use an unbound workqueue so that encryption work is
144 automatically balanced between available CPUs.
145
146 This requires kernel 4.0 or newer.
147
148 submit-from-crypt-cpus
149 Disable offloading writes to a separate thread after encryption.
150 There are some situations where offloading write bios from the
151 encryption threads to a single thread degrades performance
152 significantly. The default is to offload write bios to the same
153 thread because it benefits CFQ to have writes submitted using the
154 same context.
155
156 This requires kernel 4.0 or newer.
157
158 skip=
159 How many 512-byte sectors of the encrypted data to skip at the
160 beginning. This is different from the offset= option with respect
161 to the sector numbers used in initialization vector (IV)
162 calculation. Using offset= will shift the IV calculation by the
163 same negative amount. Hence, if offset=n is given, sector n will
164 get a sector number of 0 for the IV calculation. Using skip= causes
165 sector n to also be the first sector of the mapped device, but with
166 its number for IV generation being n.
167
168 This option is only relevant for plain devices.
169
170 size=
171 Specifies the key size in bits. See cryptsetup(8) for possible
172 values and the default value of this option.
173
174 sector-size=
175 Specifies the sector size in bytes. See cryptsetup(8) for possible
176 values and the default value of this option.
177
178 swap
179 The encrypted block device will be used as a swap device, and will
180 be formatted accordingly after setting up the encrypted block
181 device, with mkswap(8). This option implies plain.
182
183 WARNING: Using the swap option will destroy the contents of the
184 named partition during every boot, so make sure the underlying
185 block device is specified correctly.
186
187 tcrypt
188 Use TrueCrypt encryption mode. When this mode is used, the
189 following options are ignored since they are provided by the
190 TrueCrypt header on the device or do not apply: cipher=, hash=,
191 keyfile-offset=, keyfile-size=, size=.
192
193 When this mode is used, the passphrase is read from the key file
194 given in the third field. Only the first line of this file is read,
195 excluding the new line character.
196
197 Note that the TrueCrypt format uses both passphrase and key files
198 to derive a password for the volume. Therefore, the passphrase and
199 all key files need to be provided. Use tcrypt-keyfile= to provide
200 the absolute path to all key files. When using an empty passphrase
201 in combination with one or more key files, use "/dev/null" as the
202 password file in the third field.
203
204 tcrypt-hidden
205 Use the hidden TrueCrypt volume. This option implies tcrypt.
206
207 This will map the hidden volume that is inside of the volume
208 provided in the second field. Please note that there is no
209 protection for the hidden volume if the outer volume is mounted
210 instead. See cryptsetup(8) for more information on this limitation.
211
212 tcrypt-keyfile=
213 Specifies the absolute path to a key file to use for a TrueCrypt
214 volume. This implies tcrypt and can be used more than once to
215 provide several key files.
216
217 See the entry for tcrypt on the behavior of the passphrase and key
218 files when using TrueCrypt encryption mode.
219
220 tcrypt-system
221 Use TrueCrypt in system encryption mode. This option implies
222 tcrypt.
223
224 tcrypt-veracrypt
225 Check for a VeraCrypt volume. VeraCrypt is a fork of TrueCrypt that
226 is mostly compatible, but uses different, stronger key derivation
227 algorithms that cannot be detected without this flag. Enabling this
228 option could substantially slow down unlocking, because VeraCrypt's
229 key derivation takes much longer than TrueCrypt's. This option
230 implies tcrypt.
231
232 timeout=
233 Specifies the timeout for querying for a password. If no unit is
234 specified, seconds is used. Supported units are s, ms, us, min, h,
235 d. A timeout of 0 waits indefinitely (which is the default).
236
237 tmp
238 The encrypted block device will be prepared for using it as /tmp;
239 it will be formatted using mke2fs(8). This option implies plain.
240
241 WARNING: Using the tmp option will destroy the contents of the
242 named partition during every boot, so make sure the underlying
243 block device is specified correctly.
244
245 tries=
246 Specifies the maximum number of times the user is queried for a
247 password. The default is 3. If set to 0, the user is queried for a
248 password indefinitely.
249
250 verify
251 If the encryption password is read from console, it has to be
252 entered twice to prevent typos.
253
254 x-systemd.device-timeout=
255 Specifies how long systemd should wait for a device to show up
256 before giving up on the entry. The argument is a time in seconds or
257 explicitly specified units of "s", "min", "h", "ms".
258
259 At early boot and when the system manager configuration is reloaded,
260 this file is translated into native systemd units by systemd-
261 cryptsetup-generator(8).
262
264 Example 1. /etc/crypttab example
265
266 Set up four encrypted block devices. One using LUKS for normal storage,
267 another one for usage as a swap device and two TrueCrypt volumes.
268
269 luks UUID=2505567a-9e27-4efe-a4d5-15ad146c258b
270 swap /dev/sda7 /dev/urandom swap
271 truecrypt /dev/sda2 /etc/container_password tcrypt
272 hidden /mnt/tc_hidden /dev/null tcrypt-hidden,tcrypt-keyfile=/etc/keyfile
273 external /dev/sda3 keyfile:LABEL=keydev keyfile-timeout=10s
274
276 systemd(1), systemd-cryptsetup@.service(8), systemd-cryptsetup-
277 generator(8), fstab(5), cryptsetup(8), mkswap(8), mke2fs(8)
278
279
280
281systemd 243 CRYPTTAB(5)