One of nice feature of Mikrotik is can be remoted through many ways one of them is by ssh, so i can create a python script using Paramiko as ssh client module but something strange when i want to create connection to mikrotik but it always fail although add parameters such as username, password and port are correct, in the mikrotik log shown this error message
[admin@Mikrotik] /log print 12:41:24 ssh,error expected: 50 got: 5 12:42:38 ssh,error expected: 50 got: 5
When i do some searching in google i found a solution in stackoverflow by adding argument look_for_keys with value False, here an example code that work for me
import paramiko target = '192.168.56.88' ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(target, username='pigeon', password='kacangitem', look_for_keys=False) stdin,stdout,stderr = ssh.exec_command('/log print') print stdout.read()
its work! big thanks mate 🙂
LikeLike
you’re welcome bro.
LikeLike
it doesn’t work on RoutesOS 6.40.9 😦
LikeLike
is there any useful log or error message that you can share here ?
LikeLike
thank you so much for this!!! i was getting the same problem and it worked!!!
LikeLike
Thanks for de tip 😀
But in my case I have to add “allow_agent=False”…
ssh.connect(‘a.b.c.d’, username=’user’, password=’password’, allow_agent=False,look_for_keys=False)
LikeLike
cool
LikeLike