CentOS 8.x Disable graphical power-off option for non-admin users

From Notes_Wiki

Home > CentOS > CentOS 8.x > System Administration > CentOS 8.x Disable graphical power-off option for non-admin users

Normally when users do graphical login, they can use the menu option to power-off the system. If we want to disable non-admin (non-root) users from powering of the system we can use:

  1. Create '/etc/polkit-1/rules.d/55-inhibit-shutdown.rules' with:
    polkit.addRule(function(action, subject) {
    if ((action.id == "org.freedesktop.consolekit.system.stop" || action.id == "org.freedesktop.consolekit.system.poweroff") && subject.isInGroup("admin")) {
    return polkit.Result.YES;
    }
    else {
    return polkit.Result.NO;
    }
    });

Refer: https://forums.centos.org/viewtopic.php?t=58193



Home > CentOS > CentOS 8.x > System Administration > CentOS 8.x Disable graphical power-off option for non-admin users