ecryptfs-find
Find encrypted files and directories
SYNOPSIS
ecryptfs-find path
PARAMETERS
-h, --help
Display help message and exit
-v, --version
Display version information and exit
path
Path to file or directory inside eCryptfs filesystem
DESCRIPTION
eCryptfs is a stacked Linux filesystem providing kernel-level, on-the-fly encryption for data at rest. The ecryptfs-find command identifies the top-level directory (mountpoint) of an eCryptfs filesystem containing a specified path.
Given any file or directory path within an eCryptfs mount, it outputs the absolute path to the filesystem's root directory. This is invaluable for automation scripts, troubleshooting mounts, or preparing unmount operations without manually tracing directory structures.
It works by parsing /proc/mounts (or /etc/mtab) to locate eCryptfs entries, then verifies if the input path resides under one by comparing mountpoints. No root privileges are required, making it user-friendly for personal encrypted home directories common in Ubuntu.
For example, if your encrypted private files are under ~/Private, running ecryptfs-find ~/Private/somefile reveals /home/user/.Private. Failure (non-zero exit) occurs if the path lacks an enclosing eCryptfs mount, ensuring reliable scripting.
CAVEATS
Fails with non-zero exit if path is not under eCryptfs mount. Relies on accurate /proc/mounts data.
EXAMPLE
ecryptfs-find /home/user/Private/document.txt
/home/user/.Private
EXIT STATUS
0: Success (path found).
Non-zero: Path not in eCryptfs filesystem.
HISTORY
Developed by Michael Halcrow at IBM (2006), integrated into Linux kernel 2.6.19. Maintained by Canonical for Ubuntu; utils from ecryptfs-utils package.
SEE ALSO
ecryptfs-mount-private(1), mount.ecryptfs(8), umount.ecryptfs(8), ecryptfs(7)


