Getting away from being dependent on your phone and some app to manage your Two-Factor-Authentication (2FA) and instead use pass. Don’t worry, this is going to be a very short and easy read!
You should optimally already be familiar with gnupg and using pass to manage your passwords. This post will only describe upgrading your pass setup to also support 2FA.
You will need the pass, pass-otp and zbar packages. On archlinux you can install them with the following command:
pacman -S pass pass-otp zbar
With zbar, it is quite easy to decode a QR code, you don’t need some Google Authenticator app for that! Just save the image, or take a screenshot of the QR code and then simply run:
zbarimg -q <the QR Code image file>
Keep that string, you will need it in a second!
You can save the otpauth string very similar to how you would insert a new entry in pass:
pass otp add <a name of your choosing>
You enter the string starting with otpauth://...
that you got from zbar.
And that’s pretty much it for the setup.
To generate the One-Time-Password you simply run:
pass otp <the name you chose before>
And there you go, a One-Time-Password, directly generated from your shell, no phone involved!