Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I manage a server with two-factor authentication. I have to use the Google Authenticator iPhone app to get the 6-digit verification code to enter after entering the normal server password. The setup is described here: http://www.mnxsolutions.com/security/two-factor-ssh-with-google-authenticator.html

I would like a way to get the verification code using just my laptop and not from my iphone. There must be a way to seed a command line app that generates these verification codes and gives you the code for the current 30-second window.

Is there a program that can do this?

share|improve this question

3 Answers 3

up vote 7 down vote accepted

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

share|improve this answer
Is this compatible with the Google Authenticator PAM module? It seems like a different (though functionally equivalent) beast... –  voretaq7 Jul 1 '13 at 16:31
Yep - with the --totp flag, it implements the same standards-compliant TOTP alg that Google Authenticator does. –  EEAA Jul 1 '13 at 16:37

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).

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.