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:
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_Linux


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
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_Linux