I would like to send SSH commands to Unifi antennas, specifically the following command: set-inform http://unifi.<ip>:<port>/inform
. This command is fully functional with Putty but when I use the following code, I get this response:
Resp:
Err: ash: set-inform: not found
I suspect an error with the selected shell.
import paramiko
ip = 'XX.XX.XX.XX'
port = 22
username = 'XXX'
password = 'XXX'
try:
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(ip, port, username, password)
stdin, stdout, stderr = ssh.exec_command("set-inform http://unifi.<ip>:<port>/inform")
outlines = stdout.readlines()
errors = stderr.readlines()
resp = ''.join(outlines)
respErrors = ''.join(errors)
print('Resp: '+resp)
print('Err: '+respErrors)# Output
except AttributeError:
print("Erreur inconnue" + stderr)
except TimeoutError:
print("Erreur de connexion")