I am trying to get into a server using Paramiko and then get into a router that's in the server and then run a command.
However, I am not getting a password input for the router and then it just closes the connection.
username, password, port = ...
router = ...
hostname = ...
client = paramiko.SSHClient()
client.load_system_host_keys()
client.set_missing_host_key_policy(paramiko.WarningPolicy)
client.connect(hostname, port = port, username = username, password = password)
cmd = # ssh hostname@router
# password input comes out here but gets disconnected
stdin, stdout, stderr = client.exec_command(cmd)
HERE # command to run in the router
stdout.read()
client.close()
Any help?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…