Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to know what I need to do to enable a user to modify values in /sys. As it's a sysfs, changing file permissions is not an option (and I don't like to do it on every boot).

share|improve this question
I don't think it can be done, cpufreq does not change it with a regular user, it communicates with a power daemon (which runs as root) via DBUS, it's the root process doing the change, not an user process. – João Pinto Jan 7 '11 at 12:05
True, but in the end the user has (indirect) write access to /sys without providing a password (in case of the cpufreq example) - which is what I want. So I guess the key here seems to be PolicyKit. – htorque Jan 7 '11 at 13:36

You need to use sudo. If you only want to give them permission to modify a specific value without general sudo access, then you can write a script that updates that particular value, and configure your sudoers file to allow the user permission ONLY to run that script as root.

share|improve this answer
I guess that's basically the same as my PolicyKit solution, which I prefer as I don't have to modify ´/etc/sudoers´. – htorque Jan 8 '11 at 11:23

You should clarify what do you want to obtain. Maybe you want to modify /etc/sysctl.conf, see man sysctl and man sysctl.conf

share|improve this answer
Well, I'd like to change a value on-the-fly as user. This has to be possible, as the cpufreq gnome applet does the same using a D-Bus service and a PolicyKit policy - how exactly (well, a rough outline) is what I'd like to know, not being good at reading code. :P – htorque Jan 7 '11 at 10:36
If you read the first man page, you saw that you can do it at runtime. As user you should use sudo. – enzotib Jan 7 '11 at 10:43
I don't want to use sudo. – htorque Jan 7 '11 at 10:56
I don't think you can modify system parameters as a user. – enzotib Jan 7 '11 at 11:15
up vote 2 down vote accepted

I found a simple python/dbus/polkit example on the Ubuntuforums and changed the PolicyKit policy file defaults from




With this change, an unprivileged user now can communicate with the service (running as root, thus being able to write to /sys) without having to type a password (possible risks?).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.