reboot/shutdownコマンド実行するには 管理者権限 が必要で、sudoとかで指定ユーザ、指定グループに許可を出すことができる
っが、GUI画面ではメニューにrebootやらshutdownが表示されて容易に実行できてしまう
それを抑制したくて polkit を適用してみた.
[root@rockylinux9 ~]# vi /etc/polkit-1/localauthority/50-local.d/50-disallow-power-related-rurles.pkla
[Require authentication for shutdown]
Identity=unix-user:*
Action=org.freedesktop.login1.power-off*;org.freedesktop.login1.reboot*;org.freedesktop.login1.suspend*;org.freedesktop.login1.hibernate*;org.freedesktop.login1.set-reboot*
ResultAny=auth_admin
ResultInactive=auth_admin
ResultActive=auth_admin
[root@rockylinux9 ~]#
「Action」は「/usr/share/polkit-1/actions」に記載されている
[root@rockylinux9 ~]# systemctl stop polkit.service
[root@rockylinux9 ~]# systemctl start polkit.service