I have a camera streaming server based on this picamera2 example code: mjpeg_server.py and I added a button to capture a still image and save it.
Now I want this to be on port 80 (which requires me to run the python program with sudo), and I want the saved files to have my user and group id, not root:root.
I have tried os.seteuid and os.setegid but I get an error. It seems that request.save does not work with an euid/egid different from the program's uid/gid.
What is the solution? Can I run the program as non-root and somehow get permission for port 80 only at launch?
seteuid()instead, since that is far more convenient especially if this is a python script (in which case you can't use the setcap option). – goldilocks Jan 06 '24 at 16:16seteuid()and got an error. Perhaps I could create a separate process just for writing files. – hawk Jan 06 '24 at 16:38