Article 5E28Z Running Script Requiring SUDO/Root privileges from Home Folder after Login in Linux Mint 20.1

Running Script Requiring SUDO/Root privileges from Home Folder after Login in Linux Mint 20.1

by
Jezekilj Monk
from LinuxQuestions.org on (#5E28Z)
Hello everyone,

I am having trouble understanding why my script requiring root privileges from my Home folder on Linux Mint 20.1 won't run at login. Among other things I tried by adding following line with sudo visudo
Code:myusername ALL=(ALL) NOPASSWD: /full-path-to-scriptaccording to many posts this should have worked.
Command to run the script is added simply with GUI Start Applications so this rule in /etc/sudoers should have made it run without requiring root password.

If I just use NOPASSWD:ALL instead of the full path to selected script it works, but I lose all the safety as anything can run without asking for permission. So I didn't want to use this possibility.

I did find (after 10 hours of experimenting) a workaround, which I also don't exactly understand, but would still like to learn how to properly use NOPASSWD with limited list of scripts.

For people who are interested about the workaround it was to put following command in the Start Application on LM 20.1
Code:pkexec sudo full-path-to-the-scriptThis resulted with me entering my user password at login and than root password right after that, but I didn't mind till I could learn better. By just entering pkexec without sudo I also did not get any positive result, which also baffled me.latest?d=yIl2AUoC8zA latest?i=25ZT98cynX4:hsZSo8Jv2jU:F7zBnMy latest?i=25ZT98cynX4:hsZSo8Jv2jU:V_sGLiP latest?d=qj6IDK7rITs latest?i=25ZT98cynX4:hsZSo8Jv2jU:gIN9vFw25ZT98cynX4
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