Script for script launch from mikrotik to linux using ssh

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

Hello all,

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

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.

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.

The problem is still similar!
Has this ever worked for anyone at all in practice?

> /system ssh-exec address="my.domain.com" port=22 user="user" command=":put 4";
failure: authentication failure

UPDATE:

Solved!
This command must be issued from the local router, under the user with the private key!