0

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?

hawk
  • 101
  • 2
    https://stackoverflow.com/q/413807/1151724 However, you'd be better off solving your problems using 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:16
  • I already tried seteuid() and got an error. Perhaps I could create a separate process just for writing files. – hawk Jan 06 '24 at 16:38
  • 1
    If you are satisfied with your effort, fine. IMO though, you have misinterpreted whatever you mean by "got an error", and that is what you should be asking a question about. – goldilocks Jan 06 '24 at 17:34

0 Answers0