-1

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

1 Answers1

0

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
Chris
  • 232
  • 2
  • 8