Score:-1

systemd script do not set correct file permissions at boot time

cn flag

I have written a simple service that calls a bash script that should change file permissions at boot time. The issue is that it seems that the service is not working as the permissions are not changed by the time the user logs in.

However, when I run the service manually - sudo systemctl start setpermissions.service it works and the file permissions are set correctly.

This are the file permissions before the service runs:

-rw-r--r-- 1 root root 4096 Oct 25 09:04 /sys/module/8723cs/parameters/rtw_scan_interval_thr

when I run it manually (i.e. desired file permissions):

-rw-rw-rw- 1 root root 4096 Oct 25 09:10 /sys/module/8723cs/parameters/rtw_scan_interval_thr

setpermissions.service

[Unit]
Description="Set file permissions"

User=root

[Service]
StandardOutput=journal
ExecStart=/bin/sh /usr/bin/setpermissions.sh

[Install]
WantedBy=multi-user.target

What am I missing here? Have I configured my service incorrectly?

Note/Context: the whole goal of this service is that the user do not get prompted for root password when they attempt to write to sys/module/8723cs/parameters/rtw_scan_interval_thr

Score:0
it flag

The command sudo systemctl start setpermissions.service starts the service immediately in the current session.

To enable a service at boot, you need to run the following command:

sudo systemctl enable setpermissions.service

You can also enable and start the service in one command:

 sudo systemctl enable --now setpermissions.service
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.