google-authenticator. How do I generate six digits code from my Linux desktop?
consider the following situation
- I have an account at https://www.mercadolibre.com.ar. According to a new policy on login, I am asked to provide a six digits Google Authenticator code;
- I have installed google-authenticator on my Linux (Fedora) machine;
- I do not want to use any smartphone, or any Android/IOS app.
Do I have a way to generate the six digits code?
Solution 1:
You are required to use TOTP, and Google Authenticator is a common application to generate them. You aren't required to use it, you can use other programs.
TOTP uses a secret (not a key) to generate the 6 digit codes, and those codes change every 30 seconds. Basically it's a hash of the timestamp (in 30 second intervals) plus the secret, and converted to a 6-digit number.
For example, your password manager can generate the codes as well. If you aren't using a password manager, start using one right now. So ask your favorite search engine about a good password manager, install one, and use it to store the TOTP secret.
If you want to generate them yourself, you can do it in PHP, Python, Perl, Ruby, Go, Java... There's a lot to choose from.
Solution 2:
I had a similar need for 2FA on my Linux machine. While there are many ways to implement TOTP, the one I chose was Twilio Authy.
It's easy to use and supports multiple 2FA accounts. It's also available as a SNAP install.