Community discussions

 
roe1974
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 69
Joined: Mon Dec 31, 2018 2:14 pm

ppp profile -> scripts .... run as certain user

Sat Sep 14, 2019 9:31 pm

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
Forum Guru
Forum Guru
Posts: 5917
Joined: Mon Jun 08, 2015 12:09 pm

Re: ppp profile -> scripts .... run as certain user

Sat Sep 14, 2019 10:04 pm

That cannot be done. You even cannot start ssh sessions from a script.
 
roe1974
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 69
Joined: Mon Dec 31, 2018 2:14 pm

Re: ppp profile -> scripts .... run as certain user

Sat Sep 14, 2019 10:19 pm

i want to deploy a ssh comand .... not possible ?
richard
 
pe1chl
Forum Guru
Forum Guru
Posts: 5917
Joined: Mon Jun 08, 2015 12:09 pm

Re: ppp profile -> scripts .... run as certain user

Sat Sep 14, 2019 10:37 pm

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
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 69
Joined: Mon Dec 31, 2018 2:14 pm

Re: ppp profile -> scripts .... run as certain user

Sat Sep 14, 2019 10:59 pm

ok thx !
i will try this way :)
richard
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 1309
Joined: Sat Dec 24, 2016 11:17 am
Location: jo.overland at gmail.com

Re: ppp profile -> scripts .... run as certain user

Sun Sep 15, 2019 10:23 am

i have a special user ("root") for a ssh (Key based) call to an raspian like
What is your goal with this? why call the PI?
 
How to use Splunk to monitor your MikroTik Router

MikroTik->Splunk
 
 
User avatar
sebastia
Forum Guru
Forum Guru
Posts: 1790
Joined: Tue Oct 12, 2010 3:23 am
Location: Antwerp, BE

Re: ppp profile -> scripts .... run as certain user

Sun Sep 15, 2019 1:06 pm

ssh-exec has been added in 6.45.1 (viewtopic.php?t=149786&hilit=ssh-exec), and CAN be called from scripts!
 
pe1chl
Forum Guru
Forum Guru
Posts: 5917
Joined: Mon Jun 08, 2015 12:09 pm

Re: ppp profile -> scripts .... run as certain user

Sun Sep 15, 2019 1:23 pm

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.
 
User avatar
sebastia
Forum Guru
Forum Guru
Posts: 1790
Joined: Tue Oct 12, 2010 3:23 am
Location: Antwerp, BE

Re: ppp profile -> scripts .... run as certain user

Mon Sep 16, 2019 9:34 pm

search function helps: https://wiki.mikrotik.com/wiki/Manual:S ... t#SSH-exec (but not a lot yet...)
 
roe1974
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 69
Joined: Mon Dec 31, 2018 2:14 pm

Re: ppp profile -> scripts .... run as certain user

Thu Sep 19, 2019 10:59 am

i have a special user ("root") for a ssh (Key based) call to an raspian like
What is your goal with this? why call the PI?
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

Who is online

Users browsing this forum: No registered users and 13 guests