Reputation: 189
I would like to change the permission of a file in the /sys directory but the permissions keep reseting after reboot. I tried to add a chmod in the ~/.bashrc so the permission would change upon booting, but I get an error (operation not permited) in terminal. What would be the right way to do this ? Does the ~/.bashrc get executed as root ?
This is my command in ~/.bashrc
chmod 664 /sys/class/backlight/intel_backlight/brightness
And this is the error I get:
chmod: changing permissions of ‘/sys/class/backlight/intel_backlight/brightness’
: Operation not permitted
Upvotes: 0
Views: 5007
Reputation: 126526
~/.bashrc
is run as the user when the user logs in. It is not run on boot.
If you want to change the permissions on a file, you need to have permission to do so. The message is telling you that you don't have permission -- only root can do so.
The simplest way to do something custom on boot-up is to stick it in the file /etc/rc.local
. This script is run by root after booting up (so on every reboot), so you can just stick your chmod command in there.
Upvotes: 1