Use oathtool Linux command line for 2 step verification (2FA)


Originally published at:

I do not wish to use Google Authenticator or Authy app that generates 2 step verification (2FA) codes on my iOS/Android phone. Is there any way I can produce 2FA codes from Linux command line for popular sites such as Gmail, Twitter, Facebook, Amazon and more?


Using this solution, is it possible to have multiple Linux boxes from where 2FA codes can be generated for the same account?


This is the error I am getting while encrypting the key. I have inserted the key in code.
But still giving the error.


Are you using correct gpg key? Did you set up gpg key? Also don’t run command as root. This should be run as normal user.


Hi, instead of using Google Authenticator it makes more sense to try out Authy because they also allow sharing the 2FA tokens between multiple devices with default backup possibility on their systems (encrypted data with your local password) allowing multiple 2FA / authentication variants::
=> /blog/understanding-authys-multi-device-feature/
=> /blog/search-authy-2fa-ios-android/

Also for free are the Android and IOS apps “OpenOTP” from RCdevs with multiple authentication provider types:
www rcdevs com /solutions/unix/

and the OpenSource version “FreeOTP” is also availaboe on Android and IOS:
=> freeotp github io

LastPass has finally also an 2FA app which is backed up within it’s cloud.
But I didn’t like to share passwords and 2FA authentication both to same provider ;)…
And it seems that several security providers offers in meantime also their own app^…


yes as long as all account have same keys.


Yes it worked. I was using incorrect Key.