Article 59FX5 Problems with setting the correct permissions for my program

Problems with setting the correct permissions for my program

by
Leonard_Linux
from LinuxQuestions.org on (#59FX5)
Hello,

I have written a program which monitors how long the laptop is connected to wifi and disables it after 2 hours of wifi usage. My program shall be installed to /opt. In it's folder are the following files:
  • get_rfkill.sh: a bash script which simply runs rfkill -J and writes the output to rfkill_status.json
  • rfkill_status.json (see above)
  • wifi-control.desktop: The desktop file of my program
  • wifi-control.py: the main script, it is responsible for monitoring and disabling the wifi. It writes to a file which is on the users Desktop. This file can be opened by the user to check, how much time he has left. This script is also responsible for placing the wifi-control.dekstop in the users .config/autostart folder.
  • remaining_time.json: wifi-control.py saves here how much wifi time is left, so that this information doesn't get lost if the computer shutsdown.
  • uninstall.sh: a simple script which uninstalls my program
My problem now is the following: the user shall not edit remaining_time.json and rfkill_status.json, but he shall be able to run the executables. Also my programm needs permission to place files in the users home directory and it needs permission to read and edit remaing_time.json and rfkill_status.json.
I tried to handle this with a group called wifi-control. I "chowned" all the files to the group and gave the group all possible rights. I also set the setgid bit, but this way the program could not access /home/$USER.

How shall I set the permissions, so that the program is doing what it should?

According to my information the setuid bit can't be set on script files like .py or .sh. So I can't just "chown" the files to root and set the setuid bit.

Thank you in advance,
Leonard_Linuxlatest?d=yIl2AUoC8zA latest?i=xTTPhjlPi8I:2pKMCWSItp8:F7zBnMy latest?i=xTTPhjlPi8I:2pKMCWSItp8:V_sGLiP latest?d=qj6IDK7rITs latest?i=xTTPhjlPi8I:2pKMCWSItp8:gIN9vFwxTTPhjlPi8I
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