Domoticz runs Python script as root, result is denied for normal user

On various Hardware and OS systems: pi / windows / routers / nas, etc

Moderator: leecollings

Post Reply
McJohn
Posts: 91
Joined: Wednesday 10 October 2018 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: The Netherlands
Contact:

Domoticz runs Python script as root, result is denied for normal user

Post by McJohn »

We have a simple Python script which makes movies with the Raspberry PiCam when there is motion of a motion sensor.
When we run this script (as the normal Pi user) in the terminal or Raspberry GUI, the result (the movie) could be viewed within OMXPlayer.

But when this script is fired trough an event in Domoticz, the result is not viewable because Domoticz makes the permissions of the movie only viewable for the root user. With a chmod 775 command the movie could be viewed but for each movie it's very complex to do this.

And every file/movie has another name (with date and time stamp).
See script below.

What's the solution for this?

Thanks for the help and kind regards,

John


Code: Select all

#!/usr/bin/python

from time import sleep
from datetime import datetime
from picamera import PiCamera

camera = PiCamera()

timestamp = datetime.now().strftime("%d-%m-%y_%H:%M:%S")
camera.start_recording("/home/pi/Videos/Motion/{}.h264".format(timestamp))
sleep(20)
camera.stop_recording()
User avatar
ledfreak3d
Posts: 98
Joined: Sunday 01 November 2015 15:30
Target OS: Linux
Domoticz version: 3.8025
Location: Hoorn
Contact:

Re: Domoticz runs Python script as root, result is denied for normal user

Post by ledfreak3d »

i have the feeling domoticz does this for more then python scripts alone
Unleashe the magic smoke ;)
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Domoticz runs Python script as root, result is denied for normal user

Post by freijn »

dirty, i know but

do a chown in the python ( as you know the filename there)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest