Difference between revisions of "CentOS 8.x Disable graphical power-off option for non-admin users"

From Notes_Wiki
(Created page with "<yambe:breadcrumb self="Disable graphical power-off option for non-admin users">CentOS 8.x System Administration|System Administration</yambe:breadcrumb> =CentOS 8.x Disable g...")
 
m
 
Line 1: Line 1:
<yambe:breadcrumb self="Disable graphical power-off option for non-admin users">CentOS 8.x System Administration|System Administration</yambe:breadcrumb>
[[Main Page|Home]] > [[CentOS]] > [[CentOS 8.x]] > [[CentOS 8.x System Administration|System Administration]] > [[CentOS 8.x Disable graphical power-off option for non-admin users]]
=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:
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:
Line 16: Line 15:


Refer: https://forums.centos.org/viewtopic.php?t=58193
Refer: https://forums.centos.org/viewtopic.php?t=58193
[[Main Page|Home]] > [[CentOS]] > [[CentOS 8.x]] > [[CentOS 8.x System Administration|System Administration]] > [[CentOS 8.x Disable graphical power-off option for non-admin users]]

Latest revision as of 03:28, 19 April 2022

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