I need to have a bash command's user prompt request to be automatically populated (I am on Windows / Git Bash).
I have the following:
ssh -p [... many other flags and info for connection]
EDIT: The flags I am passing to ssh are:
-p -f -N -L -i
When it is executed, it asks for the user to input a "Verification code"
I have a separate python script that calculates the verification code and then prints it via print command.
#!/usr/bin/env python
import pyotp
secret="mysecret"
totp=pyotp.TOTP(secret)
print(totp.now())
I am trying to concatenate it so that the result of the python script is automatically redirected into the user prompt of the ssh command.
I have tried, with no luck, the following combinations:
ssh -p [...] < ~/totp.sh
ssh -p [...] <<< ~/totp.sh
ssh -p [...] && 0< ~/totp.sh
~/totp.sh | ssh -p [...]
printf '%s\n' ~/totp.sh | ssh -p [...]
However nothing seems to work, as ssh still asks for the user to input the "Verification code". Is there a way to automatically pass it to ssh?
Many thanks.