D
D
Dmitry2017-03-21 15:37:21
ownCloud/Nextcloud
Dmitry, 2017-03-21 15:37:21

How to give permission to run a script from another user?

Hello dear!
Motion is installed on the home server - it writes video from cameras based on motion. The files are added to a special nextcloud folder, which should be synchronized immediately after the recording is completed, and for this it needs to be given a command to scan the folder for new files on behalf of the owncloud apache user. To do this, the motion config specifies:
on_event_end /home/seventh/rescan_motion.sh
And in this script:

#!/bin/sh
sudo -u owncloud php /var/www/nextcloud/occ files:scan -p /seventh/files/motion

Only now motion itself works from its user motion, so after each motion detection, I receive an email:
*** SECURITY information for server ***
server : Mar 21 15:29:27 : motion : user NOT in sudoers ; TTY=unknown ; PWD=/ ; USER=owncloud ; COMMAND=/usr/bin/php /var/www/nextcloud/occ files:scan -p /seventh/files/motion

And, accordingly, the directory is not scanned.
How to correctly implement the plan?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question