Page 1 of 1

Script for script launch from mikrotik to linux using ssh

Posted: Tue Oct 24, 2017 10:36 pm
by meristo
Hello all,

I created a script for launch a script on my linux server form Mikrotik router using ssh.

This is the script:
/system ssh address=192.168.51.1 user=test command="/bin/bash /opt/bin/power.sh ALL off"

or, only for test also:

/system ssh address=192.168.51.1 user=test command="/bin/echo ciao >>/tmp/ciao"

both works if I launch them from Mikrotik and linux terminal but they do not work if I launch they from Mikrotik "script" interface.

Can you help me?

Thanks

Re: Script for script launch from mikrotik to linux using ssh

Posted: Thu Oct 26, 2017 10:49 am
by meristo
Hello all,

it's seems a ROS bug, can I warn Mikrotik team?

Re: Script for script launch from mikrotik to linux using ssh

Posted: Wed Jan 31, 2018 12:10 pm
by orsib
Hello.

I would like to acheive the something similar.
I would like to connect to my Synology NAS through SSH and execute a shutdown command issued by an UPS monitoring script I have developed and which is running on a mikrotik RB connected to an APC UPS.
My problem is the following. I have generated a DSA public/private keypair on my Synology NAS and using this keypair I can ssh to my Synology NAS using PUTTY on windows, so the server side seems ok. I have imported these keys using /system users ssh-keys private.
The problem is that when I issue the command /system ssh 192.168.1.7 user=orsib, my mikrotik is still requesting for password instead of using the keys to login passwordless. The user is exactly the same I have used to create the keypair on Synology. What is the solution to this? What I should finetune in sshd on Synology in order to get this work?
I would also interested the outcome of this topic as my plan is to issue commands trhough SSH using a script. So if it is not working then it is another obstacle.

Re: Script for script launch from mikrotik to linux using ssh

Posted: Wed Jan 31, 2018 12:15 pm
by orsib
Hello.

I would like to acheive the something similar.
I would like to connect to my Synology NAS through SSH and execute a shutdown command issued by an UPS monitoring script I have developed and which is running on a mikrotik RB connected to an APC UPS.
My problem is the following. I have generated a DSA public/private keypair on my Synology NAS and using this keypair I can ssh to my Synology NAS using PUTTY on windows, so the server side seems ok. I have imported these keys using /system users ssh-keys private.
The problem is that when I issue the command /system ssh 192.168.1.7 user=orsib, my mikrotik is still requesting for password instead of using the keys to login passwordless. The user is exactly the same I have used to create the keypair on Synology. What is the solution to this? What I should finetune in sshd on Synology in order to get this work?
I would also interested the outcome of this topic as my plan is to issue commands trhough SSH using a script. So if it is not working then it is another obstacle.