Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: Shutdown GNOME without root password

  1. #11

    Default Re: Shutdown GNOME without root password

    Quote Originally Posted by wolfi323 View Post
    Yes, and the root password dialog should tell you what exact polkit rule requires you to enter the password.

    So have a look there and then override the corresponding rule to /etc/polkit-default-privs.local (run set_polkit_default_privs to apply the change).
    I think it is "org.freedesktop.login1.power-off" for shutting down.

    If you only want to allow it for specific users, this should be doable as well via custom javascript code in /etc/polkit-1/rules.d/ but I have never tried to do this myself.
    This should give some clues though:
    https://wiki.archlinux.org/index.php/Polkit#Bypass_password_prompt

    PS: visudo/sudoers is only used/respected by sudo. polkit is totally independent of that though.
    Well the poweroff screen doesn't provide any hint on the corresponding rule (it only states that authentication is required: Authentication is required for powering off the system.).

    Adding "org.freedesktop.login1.power-off yes" to /etc/polkit-default-privs.local didn't work either.

    But the JavaScript you pointed me to was an eye-opener. Here is the solution that worked out for me: I added the following JavaScript code to the new file /etc/polkit-1/rules.d/49-nopasswd_shutdown.rules:

    Code:
    /* Allow members of the users group to shutdown or restart 
     * without password authentication.
     */
    polkit.addRule(function(action, subject) {
        if ((action.id == "org.freedesktop.login1.power-off" ||
             action.id == "org.freedesktop.login1.reboot") &&
            subject.isInGroup("users"))
        {
            return polkit.Result.YES;
        }
    });
    Well, now I understand why no average user will never ever switch from Windows to Linux as a desktop - after 20+ years of development even such simple tasks as this one still requires coding

  2. #12

    Default Re: Shutdown GNOME without root password

    Quote Originally Posted by nu2openS View Post
    Well the poweroff screen doesn't provide any hint on the corresponding rule (it only states that authentication is required: Authentication is required for powering off the system.).
    But the polkit dialog that shows inside GNOME should tell you. At least the KDE one does if you click on "Details".

    Adding "org.freedesktop.login1.power-off yes" to /etc/polkit-default-privs.local didn't work either.
    Did you run "set_polkit_default_privs" afterwards?

    Well, now I understand why no average user will never ever switch from Windows to Linux as a desktop - after 20+ years of development even such simple tasks as this one still requires coding
    Well, I wouldn't know how to do that in Windows either...

    And an "average user" should not have the necessity to set the system polkit permissions to "secure" (which is not intended for desktop usage anyway) while still allowing users to shutdown without password.

  3. #13

    Default Re: Shutdown GNOME without root password

    Quote Originally Posted by wolfi323 View Post
    And an "average user" should not have the necessity to set the system polkit permissions to "secure" (which is not intended for desktop usage anyway) while still allowing users to shutdown without password.
    Maybe a misunderstanding on my side, but I thought that "secure" is to be used when the computer is connected to a networked environment and multiple users share the same computer - actually my default setup at home.

  4. #14
    Join Date
    Nov 2009
    Location
    West Virginia Sector 13
    Posts
    16,123

    Default Re: Shutdown GNOME without root password

    Can't say about Gnome at all but in KDE there is a setting that allows users to shut down. I don't know if this is a KDM only thing or not

    Configure Desktop - Login Screen - Shutdown

Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •