Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@meznak
Last active October 5, 2022 08:22
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save meznak/e57b0f57f85e32088e686145d38b3fc7 to your computer and use it in GitHub Desktop.
Save meznak/e57b0f57f85e32088e686145d38b3fc7 to your computer and use it in GitHub Desktop.
Quickly generate QR codes for Google Authenticator
#!/bin/env bash
###
# Quickly generate QR codes to easily repopulate Google Authenticator.
# To use this, you'll have to have recorded your auth secret when you activated
# multi-factor authentication. When run, this script will draw QR codes into
# your terminal, which you can then scan with Google Authenticator.
#
# NB: These secrets should be treated with the same care as your password. I recommend
# you keep this file encrypted when not in use.
#
# REQUIRES: python module 'qrcode' -- https://pypi.python.org/pypi/qrcode
###
HISTCONTROL=ignoreboth
# IMPORTANT: Prefix each line with a space so it isn't logged in your bash history.
#
# Use the format below, replacing USERNAME, SECRET, and SITE with appropriate values.
# Repeat the command for each site you want to add to Authenticator.
qrcode "otpauth://totp/USERNAME?secret=SECRET&issuer=SITE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment