WebThingsIO / gateway-addon-python

Python bindings for developing add-ons for WebThings Gateway
Mozilla Public License 2.0
16 stars 10 forks source link

Run python code as root? #45

Closed flatsiedatsie closed 5 years ago

flatsiedatsie commented 5 years ago

I found a python library that emulates arping, but it still requires root to create the packets.

https://github.com/stellarbit/aioping

I know it's not possible for an add-on to require actual programs. But is it possible to run certain python code as root?

mrstegeman commented 5 years ago

Not really. A script can re-launch itself with sudo, or fork off a little process (as sudo) to do some work.

flatsiedatsie commented 5 years ago

That 'fork a little proces' sounds like it might be an idea?

mrstegeman commented 5 years ago

We try not to allow add-ons to do work as root, unless it's an exceptional circumstance where there's no other way to do what is needed.