[Debian] 移除 Debian System 的 Suspend 功能
如果要從 Debian 系選單中,移除 Suspend 的功能,應該如何達到呢?
正常來說,系統功能的選單如下:
選單中,有包含 "Suspend" 的功能,經點選 "Log Out..." 功能後,出現的對話框如下:
"Log Out..." 功能的對話框也有出現 "Suspend" 的功能。
也就是說,如果要移除 "Suspend" 功能的話,則應該把系統功能選單及 "Log Out..." 功能對話框的選項都移除。
移除的方法也不難,只需要修改設定檔即可:
/usr/share/polkit-1/actions/org.freedesktop.login1.policy
修改 "org.freedesktop.login1.suspend" 及 "org.freedesktop.login1.suspend-multiple-sessions" 項目的設定值,原本的設定為:
<action id="org.freedesktop.login1.suspend"> <description gettext-domain="systemd">Suspend the system</description> <message gettext-domain="systemd">Authentication is required to suspend the system.</message> <defaults> <allow_any>auth_admin_keep</allow_any> <allow_inactive>auth_admin_keep</allow_inactive> <allow_active>yes</allow_active> </defaults> </action> <action id="org.freedesktop.login1.suspend-multiple-sessions"> <description gettext-domain="systemd">Suspend the system while other users are logged in</description> <message gettext-domain="systemd">Authentication is required to suspend the system while other users are logged in.</message> <defaults> <allow_any>auth_admin_keep</allow_any> <allow_inactive>auth_admin_keep</allow_inactive> <allow_active>yes</allow_active> </defaults> <annotate key="org.freedesktop.policykit.imply">org.freedesktop.login1.suspend</annotate> </action>
修改為:
<action id="org.freedesktop.login1.suspend"> <description gettext-domain="systemd">Suspend the system</description> <message gettext-domain="systemd">Authentication is required to suspend the system.</message> <defaults> <allow_any>no</allow_any> <allow_inactive>no</allow_inactive> <allow_active>no</allow_active> </defaults> </action> <action id="org.freedesktop.login1.suspend-multiple-sessions"> <description gettext-domain="systemd">Suspend the system while other users are logged in</description> <message gettext-domain="systemd">Authentication is required to suspend the system while other users are logged in.</message> <defaults> <allow_any>no</allow_any> <allow_inactive>no</allow_inactive> <allow_active>no</allow_active> </defaults> <annotate key="org.freedesktop.policykit.imply">org.freedesktop.login1.suspend</annotate> </action>
之後再點選系統功能選單,或是點選 "Log Out..." 功能,都可以看到 "Suspend" 的功能已被移除:
Reference
How to remove the suspend and lock button from menu in ubuntu 17.04?
Explanation of file - org.freedesktop.login1.policy
文字內容 或 影像內容 部份參考、引用自網路,如有侵權,請告知。