ecryptfs- commands

ecryptfs is a toolset in Linux for encrypting files and directories at the filesystem level using the eCryptfs cryptographic filesystem. Here are some key commands and concepts related to using ecryptfs:

Basic ecryptfs Commands

1. Setup

  • Install eCryptfs (if not already installed):

    sudo apt-get install ecryptfs-utils   # For Debian/Ubuntu
    sudo yum install ecryptfs-utils       # For RHEL/CentOS

2. Mounting and Unmounting

  • Mount an eCryptfs-encrypted directory:

    sudo mount -t ecryptfs /encrypted/source /mount/point

    Replace /encrypted/source with the path to the encrypted directory and /mount/point with the mount point where you want to access the decrypted files.

  • Unmount an eCryptfs-encrypted directory:

    sudo umount /mount/point

3. Managing eCryptfs

  • Encrypting a Directory:

    sudo mount -t ecryptfs /source/dir /mount/point

    Follow the prompts to set up encryption options (passphrase, encryption cipher, etc.).

  • Decrypting a Directory:

    sudo umount /mount/point

4. Additional Operations

  • List eCryptfs Mounts:

    mount | grep ecryptfs

    Lists all currently mounted eCryptfs filesystems.

  • Check eCryptfs File Information:

    ecryptfs-unwrap-passphrase /path/to/wrapped-passphrase

    Extracts and displays the mount passphrase from a wrapped-passphrase file.

  • Setup Private Directory Using ecryptfs-setup-private:

    ecryptfs-setup-private

    This command will setup an encrypted private directory in the current user's home directory.

Advanced Configuration

  • Automatically Mount at Boot:

    • Add an entry to /etc/fstab with the ecryptfs filesystem type and mount options.

  • Key Management:

    • Use tools like ecryptfs-add-passphrase to manage additional passphrases for encrypted directories.

Use Cases

  • Personal File Encryption: Secure personal files or directories on your system.

  • Encrypted Backup: Store sensitive backups securely using eCryptfs.

  • Compliance: Meet regulatory requirements for data encryption and protection.

Conclusion

ecryptfs provides a straightforward method to encrypt files and directories on Linux, ensuring data security while maintaining usability. Understanding these commands and concepts allows administrators and users to effectively implement file-level encryption on their systems.

Last updated