Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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