Community discussions

MikroTik App
 
cyrusd
just joined
Topic Author
Posts: 19
Joined: Fri Jan 22, 2021 11:43 pm

Command execution not working via script

Sat Jan 11, 2025 1:32 am

Hi,

I'm trying to run the command below via a script. It runs perfectly fine in the terminal as expected, but when I write it in a script and run it, nothing happens.
log: executing script ssh-script from winbox failed, please check it manually

Script :
/system ssh address=y.y.y.y user=admin command="/user-manager user set [find name=x-x.x.x] disabled=no"

(ssh keys used for authentication)
After some investigation, I concluded that the problem is that Router A (SSH client) cannot connect to Router B (SSH server) via the script.
how to solve this?
Last edited by cyrusd on Sat Jan 11, 2025 9:46 am, edited 2 times in total.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12632
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Command execution not working via script

Sat Jan 11, 2025 9:13 am

It's on one line? Can not be on two parts in scripts like that.
 
cyrusd
just joined
Topic Author
Posts: 19
Joined: Fri Jan 22, 2021 11:43 pm

Re: Command execution not working via script

Sat Jan 11, 2025 9:47 am

yes, Its on one line.
Image
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12632
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Command execution not working via script  [SOLVED]

Sat Jan 11, 2025 7:21 pm

non interactive is /system ssh-exec
 
cyrusd
just joined
Topic Author
Posts: 19
Joined: Fri Jan 22, 2021 11:43 pm

Re: Command execution not working via script

Sat Jan 11, 2025 9:54 pm

Great help! Thank you.