On 07/24/2019 06:09 PM, David C. Rankin wrote:
On 07/23/2019 11:04 AM, andre_debian(a)numericable.fr
wrote:
The problem David,
is that in root, I receive forbidden, if I want to change the value
in the file :
/sys/class/backlight/intel_backlight/brightness
changing = no possible.
The file is 664.
Regards,
André
That's weird, and that tells me you are not actually running sudo (or you are
somehow running the script with UID or EUID 0.
With file permission 664 that is rw_rw_r__ meaning the owner has read/write,
group has read/write and world has read. If you have configured sudo (and the
sudoers file as discussed) then as root (under sudo) you have write permission
and you can change the file. So if you are getting "permission denied", your
sudo is failing.
Try this (if your range is 0-99 for brightness):
sudo sh -c "echo '"50"' >
'"/sys/class/backlight/intel_backlight/brightness"'
The screen brightness should change to 1/2 brightness. Then change it to 25,
it should change to 1/4 brightness, etc...
If that fails, you have a sudo problem. Now su to root and try the same thing.
If that fails, then we really have problems. Let me know. I suspect there is
an issue with the sudo config. You have to set it up as I showed you. The only
wildcard is whether you have a wheel group or whether your distro uses a group
called sudo instead. Check and let me know, we will get this sorted.
Also take a look at:
man systemd-backlight@.service
where systemd can save and restore the current backlight at shutdown on next
boot. That may be another alternative for you to restore the last used
backlight rather than manually saving and restoring yourself. I haven't tried
it, but it looks promising.
--
David C. Rankin, J.D.,P.E.