roe1974
September 14, 2019, 6:31pm
1
Hello
In ppp profile->scripts there is a possibility to run script “On up” / “On down”
Which Mikrotik User is running/executing the script code there ?
i have a special user (“root”) for a ssh (Key based) call to an raspian like
/system ssh xxx.xxx.xxx.xxx user=root
This works only ssh key based when i am looged in as “root”
So how i can ran the script in ppp profile as user “root” ?
Richard
pe1chl
September 14, 2019, 7:04pm
2
That cannot be done. You even cannot start ssh sessions from a script.
roe1974
September 14, 2019, 7:19pm
3
i want to deploy a ssh comand … not possible ?
richard
pe1chl
September 14, 2019, 7:37pm
4
No. But there are other tricks you can use.
E.g. you can setup the Linux machine as a network syslog server on the MikroTik (always a good thing to do!) and send a /log line to the log in the ppp-up, then in the Linux machine setup syslogd to take action on receiving that log line.
roe1974
September 14, 2019, 7:59pm
5
ok thx !
i will try this way
richard
Jotne
September 15, 2019, 7:23am
6
What is your goal with this? why call the PI?
ssh-exec has been added in 6.45.1 (http://forum.mikrotik.com/t/v6-45-1-stable-is-released/131227/1 ), and CAN be called from scripts!
pe1chl
September 15, 2019, 10:23am
8
Ah ok, I did not notice that… and it is not even completely documented in the wiki yet.
Apparently parameters are:
/system ssh-exec
output-to-file port routing-table src-address user address command
So maybe it just works when user=root is specified.
roe1974
September 19, 2019, 7:59am
10
i want to reboot the raspian via ssh when OVPN was down/up...... comand ist "/sbin/reboot"
so ican execute the script in ppp profile as user root ?
Richard