Pass input/variables to command/script over SSH using Python Paramiko

Write the input that your command needs to the stdin:

stdin, stdout, stderr = self.client.exec_command(command)
stdin.write(name + '\n')
stdin.flush()

(You will of course need to propagate the name variable from module to sendCommand, but I assume you know how to do that part).

Leave a Comment