I do this by doing all the processing on the Pi capturing the image and then doing a sftp to place the image where weewx can find it.
Greg On Sunday, November 22, 2020 at 1:47:33 PM UTC-6 Rich Strle wrote: > Thanks very much Vince. > > I appreciate your advice on the Linux Fundamentals course. > > Rich Strle > 309-824-9213 <(309)%20824-9213> > > On Sun, Nov 22, 2020 at 12:34 PM vince <[email protected]> wrote: > > > > On Sunday, November 22, 2020 at 8:44:01 AM UTC-8 Rich Strle wrote: > >> > >> Looking at my passwrd file I see: > www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin > >> Would I remove the /nologin? > >> > > > > Please don't do that. > > > > www-data is the owner of the web 'data' and your webserver process > likely runs as that user. > > The nologin there ensures that if anybody/anything breaks security on > your webserver running process, then they still wouldn't be able to get a > shell and install/run malware etc. > > > > What you want to do is: > > > > put all your processing in a script > > run that script as the non-privileged user 'pi' and write to scratch > directories that pi can write to (/tmp or /var/tmp are likely places) > > in your script, do the 'privileged' copy of the output file to the > /var/www/html directory by prefacing your 'cp' command ala 'sudo cp' > > and you'll likely want to set the permissions on the file in > /var/www/html also with 'sudo chmod' > > > > (standard suggestion - if you're asking this you need to up your > linux-fu a little - I always suggest looking at the free edx.org Linux > Fundamentals course that literally a million folks have taken) > > > > A simple script that grabs Google's logo image as an example would look > something like: > > > > #!/bin/bash > > UPSTREAM_URL=" > https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png > " > > SCRATCH_FILE="/tmp/image.jpg" > > FINAL_OUTPUT="/var/www/html/image.jpg" > > > > # wget the file in quiet mode to a temporary location > > wget -q "${URL}" "${SCRATCH_FILE}" > > > > # copy it into place and fix up permissions via sudo > > sudo cp "${SCRATCH_FILE}" "${FINAL_OUTPUT}" > > sudo chown www-data "${FINAL_OUTPUT}" > > sudo chmod 644 "${FINAL_OUTPUT}" > > > > This script did the right thing for me, FWIW. You'll of course have to > put in the right wget switches to grab your image from the camera, as well > as doing any processing with ImageMagick etc. before you copy your image > into the web tree, but this should give you a skeleton to start with that > does the permission stuff... > > > > > > -- > > You received this message because you are subscribed to a topic in the > Google Groups "weewx-user" group. > > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/weewx-user/979HfPDddwc/unsubscribe. > > To unsubscribe from this group and all its topics, send an email to > [email protected]. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/weewx-user/ca47e7f4-cdd5-4989-92f1-6af8d1a154dan%40googlegroups.com > . > -- You received this message because you are subscribed to the Google Groups "weewx-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/6b532573-933d-4e1b-b010-c54f4b8ee483n%40googlegroups.com.
