Answer the question
In order to leave comments, you need to log in
Need help setting up sudo?
Hello. Please read the question before downvoting "nubolinuksoid".
You need to allow a specific user to execute 2 scripts via sudo. And that's it. Only 2 scripts.
In this regard, the following entry appeared in /etc/sudoers:
username ALL=NOPASSWD:/home/username/hard_update.sh, /home/username/update.sh
sudo -u www-data /home/username/update.sh
username ALL=/home/username/hard_update.sh, /home/username/update.sh<br/>
username ALL=(ALL) NOPASSWD:/home/username/hard_update.sh, /home/username/update.sh
and sudo worked. Now it was necessary to repeat the focus on debian, but ...
Answer the question
In order to leave comments, you need to log in
Cmnd_Alias RUNASAPACHE /home/username/hard_update.sh, /home/username/update.sh
username ALL=(www-data) NOPASSWD: RUNASAPACHE
and then
sudo -u www-data /home/username/hard_update.sh
sudo -u www -data /home/username/update.sh
will run as apache and not as root
Specially checked now on another host with 6.0.2
Everything works fine.
Maybe try another option:
Add to sudoers the launch of all commands from the script, and not the script itself.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question