Is there a command line two-factor authentication verification code generator?

Solution 1:

Yes, oathtool can do this. You'll need to seed it with the shared secret from your server.

You can install it from the oath-toolkit package.

Solution 2:

There is also a go implementation on github at https://github.com/pcarrier/gauth

This one uses a config file ~/.config/gauth.csv to store the tokens in a the following format

[email protected]: abcd efg hijk lmno
aws-account: mygauthtoken

And the output is rather friendly too:

$ gauth
           prev   curr   next
AWS        315306 135387 483601
Airbnb     563728 339206 904549
Google     453564 477615 356846
Github     911264 548790 784099
[=======                      ]

Solution 3:

There's many 3rd party Authenticator implementations. Check out the list on the wikipedia page. For instance, you may be able to use onetimepass (which is written in Python) for command line usage.


Solution 4:

As far as I'm aware Google only releases the Authenticator application for phones (iOS, Android).
(This poses a problem for paranoid folks like me, who don't really trust Google's history of discontinuing services with little notice, and would prefer a token generator we can see inside of.)

You could consider other alternatives, like a one-time password pad system.


Honestly, getting the verification code from your laptop kind of defeats the two-factor authentication aspect (anyone who captures the laptop now has the code generator - that's part of what Authenticator is supposed to protect against).


Solution 5:

You could try http://soundly.me/oathplus

This is a tool I developed on top of the venerable oathtool, that lets you read QR codes, and stash OTP account info for later use. You can think of it as Google Authenticator for the command-line, since it can download and read QR codes, and consume otpauth:// URIs. (OSX only atm.)