I'm using Python to SSH into a host, run bash commands, and then parse results in a Pythonic way into several data structures for later display.
I'm using the Paramiko library for SSH and executing commands on the remote host like so:
ssh = paramiko.SSHClient()
ssh.exec_command("command goes here")
I'm running many commands this way and it seems most of them are working (I'm looping through a file and constructing file paths on the remote server to run the commands on). However, about halfway through execution I'm hitting this error.
I think it has something to do with the volume of ssh.exec_command() calls I'm making but I'm not sure. Any ideas?
I believe I've solved it: because exec_command() is non-blocking I was essentially trying to run a ton of commands all at once on the remote machine. This was against policy and was blocked.
I worked around this by forcing my script to wait until each command was executed via stdout.readlines(). It's working great now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With