@@ -37,6 +37,7 @@ dependencies](#runtime-dependencies).
3737- [ Building and installing] ( #building-and-installing )
3838- [ Runtime dependencies] ( #runtime-dependencies )
3939- [ Configuration file] ( #configuration-file )
40+ - [ Setting up ` fscrypt ` on a filesystem] ( #setting-up-fscrypt-on-a-filesystem )
4041- [ Setting up for login protectors] ( #setting-up-for-login-protectors )
4142 - [ Securing your login passphrase] ( #securing-your-login-passphrase )
4243 - [ Enabling the PAM module] ( #enabling-the-pam-module )
@@ -319,7 +320,8 @@ that looks like the following:
319320 "filenames": "AES_256_CTS",
320321 "policy_version": "2"
321322 },
322- "use_fs_keyring_for_v1_policies": false
323+ "use_fs_keyring_for_v1_policies": false,
324+ "allow_cross_user_metadata": false
323325}
324326```
325327
@@ -377,6 +379,54 @@ The fields are:
377379 kernels, it's better to not use this setting and instead (re-)create your
378380 encrypted directories with ` "policy_version": "2" ` .
379381
382+ * "allow\_ cross\_ user\_ metadata" specifies whether ` fscrypt ` will allow
383+ protectors and policies from other non-root users to be read, e.g. to be
384+ offered as options by ` fscrypt encrypt ` . The default value is ` false ` , since
385+ other users might be untrusted and could create malicious files. This can be
386+ set to ` true ` to restore the old behavior on systems where ` fscrypt ` metadata
387+ needs to be shared between multiple users. Note that this option is
388+ independent from the permissions on the metadata files themselves, which are
389+ set to 0600 by default; users who wish to share their metadata files with
390+ other users would also need to explicitly change their mode to 0644.
391+
392+ ## Setting up ` fscrypt ` on a filesystem
393+
394+ ` fscrypt ` needs some directories to exist on the filesystem on which encryption
395+ will be used:
396+
397+ * ` MOUNTPOINT/.fscrypt/policies `
398+ * ` MOUNTPOINT/.fscrypt/protectors `
399+
400+ (If login protectors are used, these must also exist on the root filesystem.)
401+
402+ To create these directories, run ` fscrypt setup MOUNTPOINT ` . If MOUNTPOINT is
403+ owned by root, as is usually the case, then this command will require root.
404+
405+ There will be one decision you'll need to make: whether non-root users will be
406+ allowed to create ` fscrypt ` metadata (policies and protectors).
407+
408+ If you say ` y ` , then these directories will be made world-writable, with the
409+ sticky bit set so that users can't delete each other's files -- just like
410+ ` /tmp ` . If you say ` N ` , then these directories will be writable only by root.
411+
412+ Saying ` y ` maximizes the usability of ` fscrypt ` , and on most systems it's fine
413+ to say ` y ` . However, on some systems this may be inappropriate, as it will
414+ allow malicious users to fill the entire filesystem unless filesystem quotas
415+ have been configured -- similar to problems that have historically existed with
416+ other world-writable directories, e.g. ` /tmp ` . If you are concerned about this,
417+ say ` N ` . If you say ` N ` , then you'll only be able to run ` fscrypt ` as root to
418+ set up encryption on users' behalf, unless you manually set custom permissions
419+ on the metadata directories to grant write access to specific users or groups.
420+
421+ If you chose the wrong mode at ` fscrypt setup ` time, you can change the
422+ directory permissions at any time. To enable single-user writable mode, run:
423+
424+ sudo chmod 0755 MOUNTPOINT/.fscrypt/*
425+
426+ To enable world-writable mode, run:
427+
428+ sudo chmod 1777 MOUNTPOINT/.fscrypt/*
429+
380430## Setting up for login protectors
381431
382432If you want any encrypted directories to be protected by your login passphrase,
@@ -646,11 +696,15 @@ MOUNTPOINT DEVICE FILESYSTEM ENCRYPTION FSCRYPT
646696Defaulting to policy_version 2 because kernel supports it.
647697Customizing passphrase hashing difficulty for this system...
648698Created global config file at " /etc/fscrypt.conf" .
649- Metadata directories created at " /.fscrypt" .
699+ Allow users other than root to create fscrypt metadata on the root filesystem?
700+ (See https://github.com/google/fscrypt#setting-up-fscrypt-on-a-filesystem) [y/N] y
701+ Metadata directories created at " /.fscrypt" , writable by everyone.
650702
651703# Start using fscrypt with our filesystem
652- >>>>> fscrypt setup /mnt/disk
653- Metadata directories created at " /mnt/disk/.fscrypt" .
704+ >>>>> sudo fscrypt setup /mnt/disk
705+ Allow users other than root to create fscrypt metadata on this filesystem? (See
706+ https://github.com/google/fscrypt#setting-up-fscrypt-on-a-filesystem) [y/N] y
707+ Metadata directories created at " /mnt/disk/.fscrypt" , writable by everyone.
654708
655709# Initialize encryption on a new empty directory
656710>>>>> mkdir /mnt/disk/dir1
@@ -678,8 +732,8 @@ POLICY UNLOCKED PROTECTORS
678732
679733#### Quiet version
680734``` bash
681- >>>>> sudo fscrypt setup --quiet --force
682- >>>>> fscrypt setup /mnt/disk --quiet
735+ >>>>> sudo fscrypt setup --quiet --force --all-users
736+ >>>>> sudo fscrypt setup /mnt/disk --quiet --all-users
683737>>>>> echo " hunter2" | fscrypt encrypt /mnt/disk/dir1 --quiet --source=custom_passphrase --name=" Super Secret"
684738```
685739
0 commit comments