Alternative to executing SSH in Netwatch

Good afternoon,

I have recently set up a Mikrotik device (PowerBox) with MIPSBE architecture (stable version 7.6). In said device, I attempted to configure the system utility “NetWatch” so that when a Mikrotik client -with the default IP 192.168.88.1- connects to it, it executes a SSH command. The purpose of this SSH command is to connect to the machine being plugged to the PowerBox and, subsequently, execute a certain command which configures a system package (in the connected device). Something to be mentioned at this point is that the client does not have a password, so the SSH can be accomplished with no human interaction whatsoever. I tried to execute the command in the RouterOS terminal, and the command works perfectly – the package is configured successfully.

However, just as other users have hinted in this forum, the SSH command does not work outside the terminal. Consequently, the execution of the SSH command cannot be done by NetWatch. I was therefore wondering is there is a way to accomplish this objective, as I need to connect to the machine to execute a certain command. Is there any alternative to using SSH in this context?

Thank you very much for your attention.

It seems similar to this:

http://forum.mikrotik.com/t/dhcp-lease-script-cannot-use-ssh-exec-with-public-private-key-for-automated-login/142047/1

Workaround at the end, while not exactly pretty, may be good enough for you too.

Hi, Sob, thank you very much for the answer and for the link.

In this case, I cannot apply said workaround since the clients I am working with do not rely on private/public keys for automated login. Instead, the clients do not have a password configured so that the SSH can be done directly.

Hi again, I have stumbled upon the system tool “Fetch” which works great for uploading files. I was thinking about including the command in a RSC file or in a script and subsequently transfer said file to the remote Mikrotik. However, is it possible to force the execution of the script/import file? The whole point is for the process to be automatic.