aboutsummaryrefslogtreecommitdiff
path: root/scripts/switch-to-backup-yubikey
diff options
context:
space:
mode:
authorGravatar drduh <github@duh.to> 2025-04-12 10:17:18 -0700
committerGravatar drduh <github@duh.to> 2025-04-12 10:17:18 -0700
commit82d6f2aca14720a34864a63b9ea8fb782ca1d080 (patch)
tree7946c875036c501f40af747c5c5808cb44b13ee1 /scripts/switch-to-backup-yubikey
parent68201047a8a9a72cb77477713c9ca72720eef1ef (diff)
downloadYubiKey-Guide-82d6f2aca14720a34864a63b9ea8fb782ca1d080.tar.gz
YubiKey-Guide-82d6f2aca14720a34864a63b9ea8fb782ca1d080.tar.zst
YubiKey-Guide-82d6f2aca14720a34864a63b9ea8fb782ca1d080.zip
organize scripts
Diffstat (limited to 'scripts/switch-to-backup-yubikey')
-rw-r--r--scripts/switch-to-backup-yubikey23
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/switch-to-backup-yubikey b/scripts/switch-to-backup-yubikey
new file mode 100644
index 0000000..e4d877a
--- /dev/null
+++ b/scripts/switch-to-backup-yubikey
@@ -0,0 +1,23 @@
+#!/bin/sh
+#
+# To make a duplicate Yubikey for GPG keys
+# 1. Insert Yubikey1
+# 2. Create keys/subkeys
+# 3. Run keytocard to transfer keys to Yubikey1
+# 4. QUIT WITHOUT SAVING!!!!!
+#
+# This will leave the keys on the Yubikey but NOT change the
+# GPG keyring to point to the Yubikey1 with a stub
+#
+# 5. Insert Yubikey2
+# 6. Run keytocard to transfer keys to Yubikey2
+# 7. QUIT and SAVE to make GPG point it's stubs to Yubikey2
+#
+# Running any decrypt, auth or sign will now ask you to insert Yubikey2
+# To switch to Yubikey1 at any time run this script to force GPG
+# to repoint the key stubs to the inserted Yubikey
+
+read -p "Insert the Yubikey you want to use .... " ignore
+echo "Switching GPG to backup Yubikey ..."
+
+gpg-connect-agent "scd serialno" "learn --force" /bye