linux - Why doesn't my PolicyKit localauthority file allow me to use cpufreq-set?

06
2014-04
  • ʇsәɹoɈ

    I'm trying to configure Xubuntu in such a way that I can change the CPU governor and maximum frequency (using cpufreq-set) without sudo. I created an /etc/polkit-1/localauthority/50-local.d/org.gnome.cpufreqselector.pkla file with the following contents:

    [CPU Frequency Governor]
    Identity=unix-user:myusername
    Action=org.gnome.cpufreqselector
    ResultActive=yes
    ResultAny=yes
    ResultInactive=yes
    

    Yet, even after rebooting and logging back in as myusername, cpufreq-set --max 1GHz fails with exit code 218. (The same command works fine as root.) I've tried it from a text console, from an X terminal, and from within an Xfce panel widget, all with the same failure. I've tried a few different ResultActive/ResultAny/ResultInactive combinations in that file, but they didn't make a difference. I've tried relocating the file to the /var/lib/polkit-1/localauthority/50-local.d/ directory, but it didn't help. Both polkitd and polkit-gnome-authentication-agent-1 are running.

    Can someone tell me why this isn't working? I haven't found any documentation on exit code 218; can someone tell me what it means?

  • Answers
    Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

    Related Question

    ubuntu - How to copy files to /var/www on Linux?
  • rogcg

    I'm trying to copy files to the /var/www folder on Ubuntu 10.04. But I think I don't have the permissions.

    How can I do this? Is there some specific permission I should set to this folder?

    Thanks.


  • Related Answers
  • slhck

    Since /var/www is not owned by your user, you need sudo privileges to do so. From a terminal, you could run:

    sudo cp file_you_want_to_copy /var/www
    
  • Lekensteyn

    You're missing the basics. Take a look here: http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/getting-started-guide/s1-navigating-ownership.html

    Now if you don't want to read everything: If you regularly need to edit files in /var/www, you should consider changing the owner/group and permissions on that directory.

    If your username is 'user', try this:

    sudo chown user /var/www
    

    OR:

    sudo chgrp user /var/www
    sudo chmod 775 /var/www
    

    Now you can copy a file with: cp file /var/www/

    If you just want to copy 1 file without messing with permissions, use:

    sudo cp file /var/www/
    
  • vtest

    Messing with /var/www directly when you don't have to is such a bad pitfall.

    If you have apache, learn about user directories, have a public_html in your home directory and be happy. Web hosting providers are doing this for years.

  • slhck

    Try using

    gksudo nautilus
    

    in the terminal, then navigate to /var/www and you can create, copy or delete files.