我想在python ssh -L PORT USERNAME@HOST
中执行此ssh命令
我试图这样做:
import paramiko
server = HOST
port = PORT
username = USERNAME
password = PASS
command = "-L"
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(server, port, username, password)
但是我在cmd ssh -L PORT USERNAME@HOST
中执行命令时遇到问题,我需要先插入OTP,然后再输入密码,例如
>>> ssh -L PORT USERNAME@HOST
>>> OTP: myotp
>>> Password: mypassword
如何用python实现呢?