Skip to content

Instantly share code, notes, and snippets.

@michaelmrose
Last active March 24, 2025 20:04
Show Gist options
  • Save michaelmrose/3d6ba4d9e01fd49bfca73cf7b7eaf8d2 to your computer and use it in GitHub Desktop.
Save michaelmrose/3d6ba4d9e01fd49bfca73cf7b7eaf8d2 to your computer and use it in GitHub Desktop.
Mounting ZFS native encrypted home Dir with pam and lightdm
AFTER pam_unix.so
auth optional pam_exec.so expose_authtok /usr/local/bin/zfs-unlock-home.sh ifok
remainder redacted
#!/bin/bash
# Adjust to match your dataset
ZFS_DATASET="trident/home/michael"
PASS=`cat -`
# Only try if dataset is encrypted and not mounted
if ! zfs get -H -o value mounted "$ZFS_DATASET" | grep -q "yes"; then
echo attempting to load key and mount
echo "$PASS" | zfs load-key "$ZFS_DATASET"
zfs mount "$ZFS_DATASET"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment