| 1 |
|
| 2 |
# Encrypt directory |
| 3 |
"MNT/dir" is encrypted with fscrypt. |
| 4 |
|
| 5 |
Policy: desc1 |
| 6 |
Options: padding:32 contents:AES_256_XTS filenames:AES_256_CTS policy_version:2 |
| 7 |
Unlocked: Yes |
| 8 |
|
| 9 |
Protected with 1 protector: |
| 10 |
PROTECTOR LINKED DESCRIPTION |
| 11 |
desc2 No custom protector "prot" |
| 12 |
|
| 13 |
# Lock directory |
| 14 |
"MNT/dir" is now locked. |
| 15 |
|
| 16 |
# => filenames should be in encrypted form |
| 17 |
cat: MNT/dir/file: No such file or directory |
| 18 |
|
| 19 |
# => shouldn't be able to create a subdirectory |
| 20 |
mkdir: cannot create directory 'MNT/dir/subdir': Required key not available |
| 21 |
|
| 22 |
# Unlock directory |
| 23 |
Enter custom passphrase for protector "prot": "MNT/dir" is now unlocked and ready for use. |
| 24 |
"MNT/dir" is encrypted with fscrypt. |
| 25 |
|
| 26 |
Policy: desc1 |
| 27 |
Options: padding:32 contents:AES_256_XTS filenames:AES_256_CTS policy_version:2 |
| 28 |
Unlocked: Yes |
| 29 |
|
| 30 |
Protected with 1 protector: |
| 31 |
PROTECTOR LINKED DESCRIPTION |
| 32 |
desc2 No custom protector "prot" |
| 33 |
contents |
| 34 |
|
| 35 |
# Try to lock directory while files busy |
| 36 |
[ERROR] fscrypt lock: Directory was incompletely locked because some files are |
| 37 |
still open. These files remain accessible. |
| 38 |
|
| 39 |
Try killing any processes using files in the directory, for example using: |
| 40 |
|
| 41 |
find "MNT/dir" -print0 | xargs -0 fuser -k |
| 42 |
|
| 43 |
Then re-run: |
| 44 |
|
| 45 |
fscrypt lock "MNT/dir" |
| 46 |
|
| 47 |
# => status should be incompletely locked |
| 48 |
"MNT/dir" is encrypted with fscrypt. |
| 49 |
|
| 50 |
Policy: desc1 |
| 51 |
Options: padding:32 contents:AES_256_XTS filenames:AES_256_CTS policy_version:2 |
| 52 |
Unlocked: Partially (incompletely locked) |
| 53 |
|
| 54 |
Protected with 1 protector: |
| 55 |
PROTECTOR LINKED DESCRIPTION |
| 56 |
desc2 No custom protector "prot" |
| 57 |
|
| 58 |
# => open file should still be readable |
| 59 |
contents |
| 60 |
|
| 61 |
# => shouldn't be able to create a new file |
| 62 |
bash: MNT/dir/file2: Required key not available |
| 63 |
|
| 64 |
# Finish locking directory |
| 65 |
"MNT/dir" is now locked. |
| 66 |
"MNT/dir" is encrypted with fscrypt. |
| 67 |
|
| 68 |
Policy: desc1 |
| 69 |
Options: padding:32 contents:AES_256_XTS filenames:AES_256_CTS policy_version:2 |
| 70 |
Unlocked: No |
| 71 |
|
| 72 |
Protected with 1 protector: |
| 73 |
PROTECTOR LINKED DESCRIPTION |
| 74 |
desc2 No custom protector "prot" |
| 75 |
cat: MNT/dir/file: No such file or directory |
| 76 |
mkdir: cannot create directory 'MNT/dir/subdir': Required key not available |
| 77 |
|
| 78 |
# Try to lock directory while other user has unlocked |
| 79 |
[ERROR] fscrypt lock: Directory "MNT/dir" couldn't be fully |
| 80 |
locked because other user(s) have unlocked it. |
| 81 |
|
| 82 |
If you want to force the directory to be locked, use: |
| 83 |
|
| 84 |
sudo fscrypt lock --all-users "MNT/dir" |
| 85 |
contents |
| 86 |
"MNT/dir" is now locked. |
| 87 |
cat: MNT/dir/file: No such file or directory |
| 88 |
|
| 89 |
# Try to operate on locked regular file |
| 90 |
"MNT/dir" is now locked. |
| 91 |
[ERROR] fscrypt status: cannot operate on locked regular file |
| 92 |
"MNT/file" |
| 93 |
|
| 94 |
It is not possible to operate directly on a locked regular file, since the |
| 95 |
kernel does not support this. Specify the parent directory instead. (For loose |
| 96 |
files, any directory with the file's policy works.) |
| 97 |
[ERROR] fscrypt unlock: cannot operate on locked regular file |
| 98 |
"MNT/file" |
| 99 |
|
| 100 |
It is not possible to operate directly on a locked regular file, since the |
| 101 |
kernel does not support this. Specify the parent directory instead. (For loose |
| 102 |
files, any directory with the file's policy works.) |