1 eCryptfs: A stacked cryptographic filesystem for Linux
3 eCryptfs is free software. Please see the file COPYING for details.
4 For documentation, please see the files in the doc/ subdirectory. For
5 building and installation instructions please see the INSTALL file.
9 Dustin Kirkland (userspace)
19 Web Site: http://ecryptfs.org/
21 As you should do with any filesystem, make sure to maintain a backup
22 copy of any data you write into eCryptfs. In addition, you should
23 reliably store your secret keys in a secure location. eCryptfs uses
24 industry-standard cryptographic ciphers, key generation, and
25 passphrase protection mechanisms; without your salt/passphrase or
26 private key, nobody will be able to retrieve your data.
28 eCryptfs requires the userspace tools available at:
30 <http://ecryptfs.org/downloads.html>
33 - Kernel version 2.6.19 or above
34 - Build crypto API support with at least one symmetric key cipher
35 - Build key retention support
36 - If you have an older kernel, try the latest eCryptfs full package
37 release to build a stand-alone kernel module
38 - Userspace tools obtainable from the site listed above; requirements
39 for the userspace tools are:
41 - David Howells' userspace keyring headers and libraries (version
43 - Finding its way into some distros
44 - Obtainable from <http://people.redhat.com/~dhowells/keyutils>
49 Code maturity level options --->
50 [*] Prompt for development and/or incomplete code/drivers
53 <M> Enable access key retention support
55 Cryptographic options --->
58 <M> MD5 digest algorithm
59 <M> AES cipher algorithms
62 Miscellaneous filesystems --->
63 <M> eCrypt filesystem layer support (EXPERIMENTAL)
68 eCryptfs is still in a developmental stage. When you upgrade the
69 eCryptfs kernel module, it is possible that the eCryptfs file format
70 has been updated. For this reason you should copy your files to an
71 unencrypted location and then copy the files back into the new
72 eCryptfs mount point to migrate the files. File format version 3
73 and beyond (in kernel version 2.6.24) is expected to remain readable,
77 BUILD AND INSTALL INSTRUCTIONS
79 1) Consult the INSTALL file. In the majority of cases, this step
80 should involve the standard procedure for Linux packages:
81 % ./configure --prefix=/usr && make && make install
83 2) Make sure that you have sysfs mounted and that a valid entry for
84 the sysfs mount point is in your /etc/mtab file.
89 Create a new directory into which eCryptfs will write its encrypted
90 files (i.e., /root/crypt). Then, create the mount point directory
91 (i.e., /mnt/crypt). Here is an example of how you might mount
94 mount -t ecryptfs /root/crypt /mnt/crypt
96 Note that you can also perform a layover mount (essentially,
97 converting an existing path into an eCryptfs mount point) to reduce
98 the likelihood of contention between eCryptfs and other applications
99 for access to the lower files; this is generally the recommended way
102 mount -t ecryptfs /secret /secret
104 Navigate the menus to select your preferred mount options.
107 NON-INTERACTIVE MOUNTING
109 eCryptfs supports mounting through command-line options. You can do so
110 by passing groups of name=value attribute pairs as a -o option to the
111 mount helper. Each key type has a set of name=value pairs associated
112 with it. For instance, the ``passphrase'' key type can accept a
113 ``passwd=XXX'' name=value pair and a ``salt=XXX'' name=value pair.
114 Attributes that apply to a particular key type immediately follow the
115 key type specifier ``key=XXX'' and are separated by colons.
116 Attributes that do not apply to any specific key type (general
117 attributes) are separated by comma's. The option string will take the
120 name1=value1,key=alias:name2=value2:name3=value3,name4=value4,name5=value5
122 name1=value1, name4=value4, and name5=value5 are all generic global
123 attributes that can apply to any key type. name2=value2 and
124 name3=value3 are specific to the key type.
126 A BNF grammar for the option set follows:
129 <letter> ::= (a | b | c | ... | z)
130 <letter-string> ::= <letter> (<letter-string> | <NULL>)
131 <character> ::= <any printable ASCII character that is not , or :>
132 <character-elem> ::= (<character> | <NULL>)
133 <character-string> ::= <character-elem> (<character-string> | <NULL>)
134 <name> ::= <letter-string>
135 <value> ::= <character-string>
136 <attr> ::= <name> "=" <value>
137 <comma-attr-list> ::= <attr> ("," <comma-attr-list> | <NULL>)
138 <colon-attr-list> ::= <attr> (":" <colon-attr-list> | <NULL>)
139 <key-attr-list> ::= "key=" <letter-string> (<colon-attr-list> | <NULL>)
140 <attr-list> ::= (<comma-attr-list> | <key-attr-list>)
141 <options-set> ::= <attr-list> (<attr-list> | <NULL>)
143 Values read from a file should be specified with name value pairs. For
144 example, a passphrase may be specified in a file by adding the following
149 Currently supported aliases and attributes parsed by the mount helper include:
152 passphrase_passwd=<passphrase>
153 passphrase_passwd_file=/path/to/file
154 passphrase_passwd_fd=<file descriptor>
155 passphrase_salt=<salt value>
158 openssl_keyfile=/path/to/key
159 openssl_passwd=<passphrase>
160 openssl_passwd_file=/path/to/file
161 openssl_passwd_fd=<file descriptor>
163 The following general attributes are valid kernel mount options,
164 and may also be acted upon by the mount helper, mount.ecryptfs:
166 ecryptfs_cipher=<cipher>
167 Currently supported ciphers include:
175 ecryptfs_key_bytes=<key bytes>
176 With the exception of AES-192, eCryptfs requires that the
177 keysize be a multiple of the block size.
179 ecryptfs_sig=<hex signature>
180 The signature for the FEKEK to use to encrypt the FEK for newly
181 created files. A key with description <sig> should be in the
182 user's session keyring. The mount helper, with its key modules,
183 should make sure that the key gets placed there.
186 Allows for non-eCryptfs files to be read and written from within an
187 eCryptfs mount. This option is disabled by default.
189 ecryptfs_xattr_metadata
190 When set, newly created files will have their cryptographic
191 metadata stored in the extended attribute region of the file rather
192 than the header (requires kernel support).
194 ecryptfs_encrypted_view
195 When set, this option causes eCryptfs to present applications a
196 view of encrypted files as if the cryptographic metadata were
197 stored in the file header, whether the metadata is actually stored
198 in the header or in the extended attributes.
201 When set, eCryptfs will include HMAC integrity enforcement to
202 its files (requires kernel support).
204 ecryptfs_debug=<value>
205 A value greater than 0 enables kernel debug messages, see NOTES
208 The following general attributes are parsed only by the mount helper,
212 Do not perform any key signature cache checks. By default,
213 when mounting, the eCryptfs mount helper will look for the key
214 signature in <$HOME/.ecryptfs/sig-cache.txt>. If the key
215 signature is not found, then the user will get a warning and
216 will be prompted on whether to continue and whether to add the
217 new key signature to the sig-cache.txt file. This behavior can
218 be suppressed with the no_sig_cache option.
220 If you wish to have the same passphrase used in previous passphrase
221 mounts and store it in a file (*not* recommended unless you can
222 provide sufficient protection of the file itself), you can take the
225 (Previous mount; specify passphrase on command line)
226 mount -t ecryptfs /mnt/dev /mnt/dir -o key=passphrase:passphrase_passwd=my_passphrase
228 (Next mount; have passphrase read from a file)
229 echo "passphrase_passwd=my_passphrase" > /mnt/secureusb/my_passphrase
230 mount -t ecryptfs /mnt/dev /mnt/dir -o key=passphrase:passphrase_passwd_file=/mnt/secureusb/my_passphrase
232 Saving your unencrypted passphrase to a file on the same disk that
233 contains your encrypted files defeats the purpose of using a
234 cryptographic filesystem in the first place. You should instead store
235 the file that contains your passphrase on a physically secure medium,
236 such as a USB flash drive that you keep locked in a drawer, if you
237 choose to store it to a file at all.
239 In general, it is probably best to just type in your passphrase via
240 stdin every time you need to perform a mount. Future versions of
241 eCryptfs will allow hardware token devices, such as a TPM chip, to
242 protect your secret keys.
245 TESTING A NEW MOUNT POINT
247 Try writing a new file:
249 echo "Hello, World" > /secret/hello.txt
251 The operation will complete. When you unmount eCryptfs, you will
252 Notice that there is a new file in /secret that is at least 12288
253 bytes in size (depending on your host page size). This is the
254 encrypted underlying file for what you just wrote. To test reading,
255 from start to finish, you need to clear the user session keyring:
259 Then umount /secret and mount again per the instructions given above.
261 cat /secret/hello.txt
266 You can use the PAM module to automatically use a key based on your
267 login passphrase, which can then be used to perform an eCryptfs mount
270 Perform an eCryptfs mount as root, using your user login:
272 root# mount -t ecryptfs /secret /secret
274 Then, grab your raw mount parameters from
276 root# grep "ecryptfs" /etc/mtab
278 You should get something like this:
281 /secret /secret ecryptfs rw,ecryptfs_sig=deadbeefdeadbeef,ecryptfs_key_bytes=16,ecryptfs_cipher=aes 0 0
284 Add ``user'' and ``noauto'' to the mount options:
287 /secret /secret ecryptfs user,noauto,rw,ecryptfs_sig=deadbeefdeadbeef,ecryptfs_key_bytes=16,ecryptfs_cipher=aes 0 0
290 Append your edited line to your /etc/fstab file. Now it's time to test
295 Verify that eCryptfs is not mounted. Then, log in as the regular
296 user. Manually add your passphrase to the user session keyring via the
297 ecryptfs-manager utility. Then, perform the mount, while telling the
298 mount application to not call the mount helper:
300 user# mount -i /secret
302 Verify that eCryptfs mounted correctly. Then, unmount:
306 Clear your user session keyring:
308 user# keyctl clear @u
310 Add the mount command into your login script (e.g., ~/.bash_profile):
316 Finally, add this to the appropriate /etc/pam* file (e.g.,
317 /etc/pam.d/login) after the call to pam_unix.so:
320 auth required pam_ecryptfs.so
323 You will need to insert this intelligently into your PAM stack so that
324 PAM actually calls pam_ecryptfs.so. Depending on your distribution,
325 this may involve, for instance, changing the context of pam_unix.so
326 from ``sufficient'' to ``required'' and moving pam_deny.so to another
327 location in the stack. Be mindful of the security implications of any
328 changes you make to your PAM stack.
330 From another window, try logging in as the user. If all went well, the
331 eCryptfs PAM module will insert a key derived from your login
332 passphrase into the user session keyring. Then, the login script will
333 perform the mount, using the parameters in your /etc/fstab.
335 The script src/utils/ecryptfs-setup-pam.sh attempts to automate
336 setting up PAM mounts on Red Hat-based distros. Use that for
337 inspiration in setting up your own eCryptfs PAM mount.
342 eCryptfs shipping in kernel version 2.6.19 does not support public
343 key. To determine what your current kernel supports, load the
344 ecryptfs module and view the contents of fs/ecryptfs/version_str under
345 your sysfs mount point.
347 Do not run eCryptfs in higher verbosity levels unless you are doing so
348 for the sole purpose of development, since secret values will be written
349 out to the system log in that case.
354 For the most up-to-date support resources, see
355 <http://ecryptfs.org/support.html>.
360 Please send bug reports to the Launchpad bug tracker:
361 * https://bugs.launchpad.net/ecryptfs/+filebug
363 For kernel bugs, please follow the procedure
364 detailed in the kernel documentation (Documentation/oops-tracing.txt)
365 to help us figure out what is happening.