Skip to content

Instantly share code, notes, and snippets.

@delan
Created July 4, 2023 06:39
Show Gist options
  • Save delan/b06285bcb8606c2522d05d068a166243 to your computer and use it in GitHub Desktop.
Save delan/b06285bcb8606c2522d05d068a166243 to your computer and use it in GitHub Desktop.
LUKS remote unlock over ssh for NixOS
#!/bin/sh
set -eu
stty -echo
if ! ssh "root@$1" '
set -eu
printf '\''unlocking luks on '"$1"': '\''
sed q > /crypt-ramfs/passphrase.
echo
mv /crypt-ramfs/passphrase. /crypt-ramfs/passphrase
'; then
echo failed
fi
stty echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment