Skip to content

Instantly share code, notes, and snippets.

@rtrouton
Created December 20, 2013 17:06
Show Gist options
  • Save rtrouton/8057983 to your computer and use it in GitHub Desktop.
Save rtrouton/8057983 to your computer and use it in GitHub Desktop.
Expect script that uses fdesetup change recovery to generate a new individual recovery key using a institutional recovery key for authorization.
#!/usr/bin/expect
log_user 0
set password s3kr1tp4ssw0rd
spawn fdesetup changerecovery -personal -key /path/to/keychain_with_both_private_and_public_keys_inside.keychain -outputplist > /path/to/new_recovery_key.plist
expect "keychain: "
send "$password\n"
log_file -a /path/to/new_recovery_key.plist
expect EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment