參考文獻:https://vivaldi.club/d/11869
# vi /etc/polkit-1/localauthority/50-local.d/restrict-login-powermgmt.pkla
[Disable lightdm PowerMgmt]
Identity=unix-user:*
Action=org.freedesktop.login1.reboot;org.freedesktop.login1.reboot-multiple-sessions;org.freedesktop.login1.power-off;org.freedesktop.login1.power-off-multiple-sessions;org.freedesktop.login1.suspend;org.freedesktop.login1.suspend-multiple-sessions;org.freedesktop.login1.hibernate;org.freedesktop.login1.hibernate-multiple-sessions
ResultAny=no
ResultInactive=no
ResultActive=no
:x
再用gui介面登入後就會發現沒有poweroff的按鈕了。
shutdown指令以下列方式處理:
# vi /etc/sudoers
# User privilege specification
root ALL=(ALL:ALL) ALL
user ALL=(ALL:ALL) ALL, !SHUTDOWN
:x
存檔後就鎖住該帳下shutdown的功能。
$ shutdown -k
Failed to call ScheduleShutdown in logind, proceeding with immediate shutdown: Access denied
Need to be root.
留言列表