...just a quick question... I think I already know the answer but.. just to be sure:
Domotiz runs as root user...
are Python plugin under the same rule? (so they run as root?)
what If I want to run them as another user?...is that possible?
ciao
M
Python Plugin question
Moderator: leecollings
- emme
- Posts: 909
- Joined: Monday 27 June 2016 11:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest
- Location: Milano, Italy
- Contact:
Python Plugin question
The most dangerous phrase in any language is:
"We always done this way"
"We always done this way"
-
- Posts: 81
- Joined: Sunday 04 January 2015 0:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest-1
- Location: /dev/null
- Contact:
Re: Python Plugin question
Never, ever, run Domoticz or any other service as root. This sentence should be read at least 10 times.
That said, any process started by another process will run in the same user-context. So if Domoticz is running as userX, everything else will run as the same user. You could start, e.g. via the Python plugin, another process as another user. Maybe you have a reason to do so but I can't think of any.
--Gerard

That said, any process started by another process will run in the same user-context. So if Domoticz is running as userX, everything else will run as the same user. You could start, e.g. via the Python plugin, another process as another user. Maybe you have a reason to do so but I can't think of any.
--Gerard
- emme
- Posts: 909
- Joined: Monday 27 June 2016 11:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest
- Location: Milano, Italy
- Contact:
Re: Python Plugin question
My question was in regards of a plugin I'm writing and for which I'm stucked at base level...
I'm using gattlib, that must be run as root to get access to hci0 interface
the plugin doesn't run, so I was wondoering if it could be a user problem, but I assume it is not....
I'm using gattlib, that must be run as root to get access to hci0 interface
the plugin doesn't run, so I was wondoering if it could be a user problem, but I assume it is not....

The most dangerous phrase in any language is:
"We always done this way"
"We always done this way"
-
- Posts: 81
- Joined: Sunday 04 January 2015 0:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest-1
- Location: /dev/null
- Contact:
Re: Python Plugin question
Well, I suppose it's running ok outside domoticz?
Just to be sure you can check from within the plugin if indeed you are running within the root context.
This is how I start (sub)processes
--Gerard
Just to be sure you can check from within the plugin if indeed you are running within the root context.
This is how I start (sub)processes
Code: Select all
import subprocess
prc = subprocess.run(['whoami'], stdout=subprocess.PIPE)
iAm = prc.stdout.decode('utf-8')
Domoticz.Log("I am user:" + iAm)
Who is online
Users browsing this forum: No registered users and 1 guest