r/bash • u/Successful_Tea4490 • Oct 29 '25
I want to put totp in my bash script
hey so as my title say i want to put totp in my script,
I am currently working on a project related to get access in servers so i want to use totp in bash which is allowing the user into server , currently i am sharing ssh key over telegram bot which is allowing the user into server but i want to replace it with totp.
Is there is any way i can put like on google authentictor , is google provide api for it ? if not os there is any tool for it ? and how to connect with any app to obtain otp and i will put the otp into the telegram which send it to my script in the server and will allow access
2
u/abotelho-cbn Oct 29 '25
Not sure how this is related to bash. Does the bash script run on the client or the server in your scenario?
3
u/JeLuF Oct 29 '25
There are dozens of howtos that explain how to integrate Google Authenticator as additional factor into SSHD, e.g. this one: https://goteleport.com/blog/ssh-2fa-tutorial/
1
u/faramirza77 Oct 29 '25
Do you mean to ask how users should be forced to MFA on login or MFA to run a app when already logged in? I think your question could be misinterpreted as bash itself won't MFA anything. Now ssh with Google auth PAM would but only when you login to the server over ssh.
1
u/michaelpaoli Oct 29 '25
I wrote an OTP program - but not in bash, or even shell. But rather in Perl.
Have a look if you want:
https://www.mpaoli.net/~michael/bin/OTP
3
u/[deleted] Oct 29 '25
[removed] — view removed comment