How to set permissions in /sys/ permanent?
No you can't, the permission of sysfs is defined in kernel space and can't be changed with userspace tools (unless with kernel side support).
But for your own problem, you could setup a sudo entry that allow everyone to write to that path, i.e ALL ALL = (ALL) NOPASSWD: /usr/bin/tee /sys/class/leds/asus\:\:kbd_backlight/brightness
And when you write to that directory, use a script like this, echo 1 | sudo /usr/bin/tee "/sys/class/leds/asus::kbd_backlight/brightness"
I had a similar problem, I needed to set the permissions before running the nodered service. Following the comment of goldilocks I created this systemd script:
$ cat /etc/systemd/system/setledspermissions.service
[Unit]
Description=Set leds writable to everybody
Before=nodered.service
[Service]
Type=oneshot
User=root
ExecStart=/bin/bash -c "/bin/chmod a+w /sys/class/leds/led0/*"
[Install]
WantedBy=multi-user.target
After writing the service file I enabled it with
$ sudo systemctl enable setledspermissions.service
$ sudo systemctl start setledspermissions.service
$ sudo systemctl status setledspermissions.service
The /sys
directory in Linux is fake, it is a view into the kernel dressed up as files. So to change permissions in it permanently means hackig the kernel, and that would be ill-advised. As the comments say, perhaps a systemd
unit setting this would be a solution (in general, set the change up as part of the boot process).