Skip to content

Instantly share code, notes, and snippets.

@Realetive
Forked from martint17r/oath-qrcode.sh
Created October 11, 2022 23:38
Show Gist options
  • Save Realetive/d4f451e20cd47a1c68fac56b8be67f68 to your computer and use it in GitHub Desktop.
Save Realetive/d4f451e20cd47a1c68fac56b8be67f68 to your computer and use it in GitHub Desktop.
Generate TOTP QRcode for Google Authenticator for 2FA on linux debian wheezy
#!/bin/bash
USERNAME=$1
HOSTNAME=$(hostname --fqdn)
qrencode -t ANSI256 -o - $(echo otpauth://totp/$USERNAME@$HOSTNAME?secret=$(oathtool --totp -v $(grep $USERNAME /etc/users.oath | cut -f 4) | grep Base32 | cut -d " " -f 3))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment