Send Motion-user mailing list submissions to motion-user@lists.sourceforge.net
To subscribe or unsubscribe via the World Wide Web, visit https://lists.sourceforge.net/lists/listinfo/motion-user or, via email, send a message with subject or body 'help' to motion-user-requ...@lists.sourceforge.net You can reach the person managing the list at motion-user-ow...@lists.sourceforge.net When replying, please edit your Subject line so it is more specific than "Re: Contents of Motion-user digest..." Today's Topics: 1. Re: can Motion be run without using sudo (Ted Romer) 2. Re: can Motion be run without using sudo (rmbusy) ---------------------------------------------------------------------- Message: 1 Date: Mon, 15 Jul 2019 18:57:14 -0500 From: Ted Romer <li227...@gmail.com> To: Motion discussion list <motion-user@lists.sourceforge.net> Subject: Re: [Motion-user] can Motion be run without using sudo Message-ID: <706f81b4-fac5-4693-8c28-07c0da340...@gmail.com> Content-Type: text/plain; charset="utf-8" Putting the pid file and log in the home directory is a good idea. Do you have Motion set to start on reboot? If so, how do you configure it? I have three Pis running Motion and I have a call in rc.local to start Motion on reboot. That gets Motion restarted when the power goes out. Ted Sent from my iPad > On Jul 15, 2019, at 6:23 PM, Jack Christensen <christensen.jac...@gmail.com> > wrote: > > I've been running Motion on several Pi Zero W machines without sudo. I like > to create my own user (jack) instead of using pi but I think pi should work > the same. > > The config file is /home/jack/.motion/motion.conf > > Log and pid files are in my home directory. In the config file I have: > > daemon on > setup_mode off > pid_file /home/jack/motion.pid > log_file /home/jack/motion.log > > I start motion just with a simple "motion" command. > > Works very well. > > > >> On 7/15/19 6:51 PM, Ted Romer wrote: >> Hi all, >> >> Thanks for the suggestions. Unfortunately, none have worked. I tried editing >> /etc/default/motion and setting it to ?yes? (without the quotes) and then I >> issued the command ?sudo systemctl enable motion? (without the quotes) and >> then rebooted. Motion failed to start. This is what I got when I typed sudo >> systemctl status motion >> >> Jul 15 17:33:39 sPiCam2 systemd[1]: Starting LSB: Start Motion detection... >> Jul 15 17:33:42 sPiCam2 motion[257]: Starting motion detection daemon: >> motion. >> Jul 15 17:33:43 sPiCam2 systemd[1]: Started LSB: Start Motion detection. >> Jul 15 17:33:50 sPiCam2 motion[329]: [17090184:motion] [NTC] [ALL] >> conf_load: Processing thread 0 - config file /etc/motion >> Jul 15 17:33:50 sPiCam2 motion[329]: [17090184:motion] [ALR] [ALL] >> conf_cmdparse: Unknown config option "mmalcam_name" >> Jul 15 17:33:50 sPiCam2 motion[329]: [17090184:motion] [NTC] [ALL] >> motion_startup: Motion 4.1.1 Started >> Jul 15 17:33:50 sPiCam2 motion[329]: [17090184:motion] [ERR] [ALL] myfopen: >> Error opening file /var/log/motion/motion.log w >> Jul 15 17:33:50 sPiCam2 motion[329]: [17090184:motion] [EMG] [ALL] >> motion_startup: Exit motion, cannot create log file /var >> >> Every time I try to get it to run as a service I get the file permissions >> error on /var/log/motion/motion.log >> >> It runs okay when I use "sudo motion -c /.motion/motion.conf" or " sudo >> motion -c /etc/motion/motion.conf? (Ihave the motion.conf file in both >> locations >> >> Ted >> >> >> >>> On Jul 15, 2019, at 2:40 PM, Allan Peda <bizco...@gmail.com> wrote: >>> >>> Be sure SELinux is off before you start adjusting permissions. I am >>> running motion with it enabled, but permissions are trickier when it's set >>> to enforcing. >>> >>> Here's an article explaining: >>> https://www.tecmint.com/disable-selinux-temporarily-permanently-in-centos-rhel-fedora/ >>> >>> As to the service, in a modern distro, the systemd subsystem controls why >>> user "owns" a given service. >>> https://askubuntu.com/questions/676007/how-do-i-make-my-systemd-service-run-via-specific-user-and-start-on-boot#676022 >>> >>> You'll need to master commands chown, and chmod to get those files >>> writeable without destroying security. >>> >>> >>>> On Sun, Jul 14, 2019 at 11:48 PM Ted Romer <li227...@gmail.com> wrote: >>>> I upgraded one of my systems and I am trying to see if I can run Motion >>>> without sudo. I have a Pi Zero W with Buster Lite and Motion 4.1.1. I have >>>> been starting Motion on my systems with sudo but I would like to see if I >>>> can get it to run without sudo. My user account is pi. If I try to run >>>> Motion as pi it fails out due to lack of permission to write to >>>> /var/log/motion/motion.log and also cannot create the pid file. If I try >>>> to get Motion to start as a service I get file permissions errors on >>>> /var/log/motion/motion.log. When I start motion with sudo, my jpg and >>>> video files are created with root as the owner. I am having the files >>>> saved in a directory in pi?s home directory. >>>> >>>> I have been searching for information pertaining to how to configure and >>>> deal with the permissions issues but have not found a solution. Is there a >>>> way to do it without sudo? >>>> >>>> Thanks. >>>> >>>> Ted >>>> >>>> _______________________________________________ >>>> Motion-user mailing list >>>> Motion-user@lists.sourceforge.net >>>> https://lists.sourceforge.net/lists/listinfo/motion-user >>>> https://motion-project.github.io/ >>>> >>>> Unsubscribe: https://lists.sourceforge.net/lists/options/motion-user >>> _______________________________________________ >>> Motion-user mailing list >>> Motion-user@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/motion-user >>> https://motion-project.github.io/ >>> >>> Unsubscribe: https://lists.sourceforge.net/lists/options/motion-user >> >> >> >> >> _______________________________________________ >> Motion-user mailing list >> Motion-user@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/motion-user >> https://motion-project.github.io/ >> >> Unsubscribe: https://lists.sourceforge.net/lists/options/motion-user > _______________________________________________ > Motion-user mailing list > Motion-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/motion-user > https://motion-project.github.io/ > > Unsubscribe: https://lists.sourceforge.net/lists/options/motion-user -------------- next part -------------- An HTML attachment was scrubbed... ------------------------------ Message: 2 Date: Mon, 15 Jul 2019 16:58:17 -0700 From: rmbusy <rmbusy+mot...@gmail.com> To: motion-user@lists.sourceforge.net Subject: Re: [Motion-user] can Motion be run without using sudo Message-ID: <13adf487-2d30-da29-4388-b44b02cdb...@gmail.com> Content-Type: text/plain; charset="utf-8"; Format="flowed" Ted, Some or all of this may help you out.? I started by installing motion using the Debian package manager.? That set up everything for a older version.? Then I built the latest motion from source, and removed the package manager installed version. On my system, I mount a 8TB USB 3.0 drive to /video in /etc/fstab.? The /video share is where I put all the Motion files, including the log file (easy to save if the OS implodes). Looking back at notes I took while setting up the built from source version of Motion to auto start, I did these things after the package manager version install : Update paths so startup finds new config file (not sure these are really needed) : mv /etc/motion /etc/motion.bak ln -s /video/motion /etc/motion mv /usr/local/etc/motion /usr/local/etc/motion.bak ln -s /video/motion /usr/local/etc/motion Make sure all config files and directories are owned by user motion : chown -R motion /video chgrp -R motion /video If /run/motion directory doesn't exist, create it : mkdir /run/motion chown -R motion /run/motion chgrp -R motion /run/motion Update init.d startup script with new paths : Edit /etc/init.d/motion Add following line after variables at the top : OPTIONS='-c /video/motion.conf -l /video/motion.log -b' Add ':/usr/local/bin' to the end of the PATH_BIN variable (location of my motion binary) Change variable 'DAEMON= to point to the motion binary (/usr/local/bin in my case) In the 'start' case, at the end of the line with "if start-stop-daemon", add "-- $OPTIONS" before the semicolon (" ; then"). In the 'status' case, change 'status_of_proc' path to /usr/local/bin Update Unit file : systemctl daemon-reload Start Motion : systemctl start motion (or reboot) It took some fiddling to finally get it working (may not need all steps above), but now it starts at boot time.? If you change something in the camera files, or motion.conf, just run systemctl restart motion to pick up those changes. If you change something in the /etc/init.d/motion file, you need to re-run systemctl daemon-reload before running the restart command. Hope this helps. -- Rob. On 7/15/19 3:51 PM, Ted Romer wrote: > Hi all, > > Thanks for the suggestions. Unfortunately, none have worked. I tried > editing /etc/default/motion and setting it to ?yes? (without the > quotes) and then I issued the command ?sudo systemctl enable motion? > (without the quotes) and then rebooted. Motion failed to start. This > is what I got when I typed sudo systemctl status motion > > Jul 15 17:33:39 sPiCam2 systemd[1]: Starting LSB: Start Motion > detection... > Jul 15 17:33:42 sPiCam2 motion[257]: Starting motion detection daemon: > motion. > Jul 15 17:33:43 sPiCam2 systemd[1]: Started LSB: Start Motion detection. > Jul 15 17:33:50 sPiCam2 motion[329]: [17090184:motion] [NTC] [ALL] > conf_load: Processing thread 0 - config file /etc/motion > Jul 15 17:33:50 sPiCam2 motion[329]: [17090184:motion] [ALR] [ALL] > conf_cmdparse: Unknown config option "mmalcam_name" > Jul 15 17:33:50 sPiCam2 motion[329]: [17090184:motion] [NTC] [ALL] > motion_startup: Motion 4.1.1 Started > Jul 15 17:33:50 sPiCam2 motion[329]: [17090184:motion] [ERR] [ALL] > myfopen: Error opening file /var/log/motion/motion.log w > Jul 15 17:33:50 sPiCam2 motion[329]: [17090184:motion] [EMG] [ALL] > motion_startup: Exit motion, cannot create log file /var > > Every time I try to get it to run as a service I get the file > permissions error on /var/log/motion/motion.log > > It runs okay when I use "sudo motion -c /.motion/motion.conf" ? ?or ? > " sudo motion -c /etc/motion/motion.conf? ? (Ihave the motion.conf > file in both locations > > Ted > > > >> On Jul 15, 2019, at 2:40 PM, Allan Peda <bizco...@gmail.com >> <mailto:bizco...@gmail.com>> wrote: >> >> Be sure SELinux is off before you start adjusting permissions.? I am >> running motion with it enabled, but permissions are trickier when >> it's set to enforcing. >> >> Here's an article explaining: >> https://www.tecmint.com/disable-selinux-temporarily-permanently-in-centos-rhel-fedora/ >> >> As to the service, in a modern distro, the systemd subsystem controls >> why user "owns" a given service. >> https://askubuntu.com/questions/676007/how-do-i-make-my-systemd-service-run-via-specific-user-and-start-on-boot#676022 >> >> You'll need to master commands chown, and chmod to get those files >> writeable without destroying security. >> >> >> On Sun, Jul 14, 2019 at 11:48 PM Ted Romer <li227...@gmail.com >> <mailto:li227...@gmail.com>> wrote: >> >> I upgraded one of my systems and I am trying to see if I can run >> Motion without sudo. I have a Pi Zero W with Buster Lite and >> Motion 4.1.1. I have been starting Motion on my systems with sudo >> but I would like to see if I can get it to run without sudo. My >> user account is pi. If I try to run Motion as pi it fails out due >> to lack of permission to write to /var/log/motion/motion.log and >> also cannot create the pid file. If I try to get Motion to start >> as a service I get file permissions errors on >> /var/log/motion/motion.log. When I start motion with sudo, my jpg >> and video files are created with root as the owner. I am having >> the files saved in a directory in pi?s home directory. >> >> I have been searching for information pertaining to how to >> configure and deal with the permissions issues but have not found >> a solution. Is there a way to do it without sudo? >> >> Thanks. >> >> Ted >> >> _______________________________________________ >> Motion-user mailing list >> Motion-user@lists.sourceforge.net >> <mailto:Motion-user@lists.sourceforge.net> >> https://lists.sourceforge.net/lists/listinfo/motion-user >> https://motion-project.github.io/ >> >> Unsubscribe: https://lists.sourceforge.net/lists/options/motion-user >> >> _______________________________________________ >> Motion-user mailing list >> Motion-user@lists.sourceforge.net >> <mailto:Motion-user@lists.sourceforge.net> >> https://lists.sourceforge.net/lists/listinfo/motion-user >> https://motion-project.github.io/ >> >> Unsubscribe: https://lists.sourceforge.net/lists/options/motion-user > > > > _______________________________________________ > Motion-user mailing list > Motion-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/motion-user > https://motion-project.github.io/ > > Unsubscribe: https://lists.sourceforge.net/lists/options/motion-user -------------- next part -------------- An HTML attachment was scrubbed... ------------------------------ ------------------------------ Subject: Digest Footer _______________________________________________ Motion-user mailing list Motion-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/motion-user ------------------------------ End of Motion-user Digest, Vol 157, Issue 12 ********************************************