How to view secret totp

frankz

Active Member
Nov 16, 2020
371
24
38
Hi is possible from shell view a secret OTP for user root or other user ? I need this key for one programs can't export data but import or create from secretly . Thank





Screenshot 2025-03-08 alle 15.51.48.png
 
Hi is possible from shell view a secret OTP for user root or other user ?

Not without tinkering, as far as I know. You need to have the secret seed, of course. @fireon showed where this can be found.

The tool we need is "oathtool", which is not installed by default:
Code:
~# apt install oathtool

Someone else needs to chime in to show us how to extract the "secret=" out of "tfa.cfg". I am too stupid to handle "jq" :-(

Lets say the secret is stored in the variable SECRET, then this works:
Code:
 ~$ echo $SECRET | oathtool  --totp -b - 
475487

And as usual: man oathtool tells you more... :-)
 
  • Like
Reactions: Lukas Moravek
Not without tinkering, as far as I know. You need to have the secret seed, of course. @fireon showed where this can be found.

The tool we need is "oathtool", which is not installed by default:
Code:
~# apt install oathtool

Someone else needs to chime in to show us how to extract the "secret=" out of "tfa.cfg". I am too stupid to handle "jq" :-(

Lets say the secret is stored in the variable SECRET, then this works:
Code:
 ~$ echo $SECRET | oathtool  --totp -b -
475487

And as usual: man oathtool tells you more... :-)
Thank you, and the code works regarding the token number, what I serve is the key in short the one you see the first time in the qrcode. Thank you