E4CRYPT(8)
๐ E4CRYPT(8) ๐
okay bestie, sit down, hydrate, because today we're learning e4crypt โ yes that's section 8 of the system manager's manual, we love a system admin era ๐
this is the ext4 file system encryption utility, and honestly? it's giving security, it's giving secrets, it's giving your files are none of anybody's business ๐โจ
โจ NAME โจ
e4crypt โ ext4 file system encryption utility ๐ฆ
like. that's it. that's the whole vibe. it does encryption management for ext4 file systems and it does it well.
๐ SYNOPSIS ๐
e4crypt add_key -S [ -k keyring ] [-v] [-q] [ -p pad ] [ path ... ]
e4crypt new_session
e4crypt get_policy path ...
e4crypt set_policy [ -p pad ] policy path ...
four whole commands. four. we're eating today ๐
๐ธ DESCRIPTION ๐ธ
e4crypt performs encryption management for ext4 file systems. periodt. that's the mission statement, that's the whole personality ๐
๐ COMMANDS ๐
๐ e4crypt add_key [-vq] [-S salt ] [-k keyring ] [ -p pad ] [ path ... ]
so this one prompts you for a passphrase and then inserts it into the keyring you told it about. and if you didn't tell it about one? no worries bestie, e4crypt will use the session keyring if it exists, or the user session keyring if it doesn't. it's flexible like that ๐ซถ
now, a salt is what turns your cute little passphrase into an actual encryption key. and the whole point is: if you use the same passphrase in different contexts, different salt values give you different encryption keys. so nobody's out here reusing the same key across everything like a menace. iconic behavior honestly.
by default, e4crypt will examine all mounted ext4 file systems, and insert an encryption key salted with each file system with encryption enabled, using its default salt value. yes, each one. it's thorough. it's a completionist. we stan ๐
but alternatively โ if you specify an explicit salt, that salt value gets used to calculate the encryption key from the passphrase. and here's how it reads your salt argument, depending on the first characters:
- if the first two characters of salt are
s:โ the rest of the argument is used as a text string, and that's your salt value ๐ฌ - if the first two characters are
0xโ the rest of the argument is parsed as a hex string, and that hex value becomes the salt ๐ข - if the first characters are
f:โ the rest of the argument is interpreted as a filename, and the salt value gets read from that file ๐ - if the string begins with a
/character โ same deal, it's treated as a filename ๐ - and finally, if the salt argument parses as a valid UUID โ then that UUID value is used as the salt value ๐
the keyring argument specifies the keyring to which the key should be added. simple. clean. no notes.
the pad value specifies the number of bytes of padding that will be added to directory names, for obfuscation purposes (sneaky, we love). valid pad values are 4, 8, 16, and 32 โ those four, nothing else, don't try it ๐
and if you specify one or more directory paths? e4crypt will try to set the policy of those directories to use the key just added by the add_key command. if a salt was explicitly specified, that's what gets used to derive the encryption key of those directories. otherwise, a directory-specific default salt gets used. so many salts. so much flavor ๐งโจ
๐ e4crypt get_policy path ...
prints the policy for the directories you specified on the command line. that's it, that's the whole thing, it's a lil peek at what's going on ๐
๐ฑ e4crypt new_session
gives the invoking process (typically a shell) a brand new session keyring โ and discards its old session keyring. out with the old, in with the new. main character energy, honestly ๐
๐ e4crypt set_policy [ -p pad ] policy path ...
sets the policy for the directories specified on the command line.
โ ๏ธ okay important one: all directories must be empty to set the policy. empty. like, nothing in there. don't test it.
and if the directory already has a policy established, e4crypt will validate that the policy matches what was specified โ so it's checking your work, respectfully ๐
a policy is an encryption key identifier consisting of 16 hexadecimal characters. sixteen. hex. that's the whole format, memorize it iykyk ๐ฅ
๐ซถ AUTHOR ๐ซถ
written by Michael Halcrow <mhalcrow@google.com>, Ildar Muslukhov <muslukhovi@gmail.com>, and Theodore Ts'o <tytso@mit.edu> โ absolute legends, the founding mothers and fathers of your encrypted filesystem, no cap ๐
๐ SEE ALSO ๐
go read those too, they're all part of the extended cinematic universe ๐
and that's the whole page bestie!! this came to you courtesy of E2fsprogs version 1.47.4, dated March 2025 โ so you know it's fresh, you know it's current, you know it ate ๐ โจ bye ily, go encrypt something ๐
๐ฆ where this page comes from
- alpine 3.24: e2fsprogs-doc 1.47.4-r0 ยท GPL-2.0-or-later AND LGPL-2.0-or-later AND BSD-3-Clause AND MIT
- arch rolling: e2fsprogs 1.47.4-1 ยท GPL AND LGPL AND MIT
- nixpkgs unstable: e2fsprogs 1.47.4
- ubuntu stonking: e2fsprogs 1.47.4-1 ยท GPL-2.0-only
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms