Article 5GKP6 How to use pkexec to run a single type of command, from a single program, but without a password?

How to use pkexec to run a single type of command, from a single program, but without a password?

by
A_UK_LinuxUser
from LinuxQuestions.org on (#5GKP6)
Dear all

I have a Bash script called 'syncOut'. It contains, among its many commands, a single command with this form:

Code:pkexec rsync <arguments that are set by variables`I want the script to run the command with superuser privileges but without authentication. (I want that not to hold, though, for anything else in the script, and not for rsync commands run outside the script.) The script is run from the GUI (and specifically via a plugin to a graphically-running file manager).

I found some relevant guides on the web but they are hard for me to understand. I do have a fair amount of knowledge of Linux and of Bash but the guides seem somewhat unclear and/or not about my use case. I gather that I will need to create a pkexec policy file. But where? And what should it contain?

Thank you.

PS: Using either `sudo` or `gksudo` (or indeed `su`) does NOT suit my case.
PPS: I put this post on Reddit, initially - but it's not doing well there.latest?d=yIl2AUoC8zA latest?i=-g4_UiDOoGg:mNLYl6q6PW0:F7zBnMy latest?i=-g4_UiDOoGg:mNLYl6q6PW0:V_sGLiP latest?d=qj6IDK7rITs latest?i=-g4_UiDOoGg:mNLYl6q6PW0:gIN9vFw-g4_UiDOoGg
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments