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