[Debian] 移除 Debian System 的 Suspend 功能

如果要從 Debian 系選單中,移除 Suspend 的功能,應該如何達到呢?
image    image

 

 

正常來說,系統功能的選單如下:
image

 

 

選單中,有包含 "Suspend" 的功能,經點選 "Log Out..." 功能後,出現的對話框如下:
image

"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" 的功能已被移除:
image    image

 

 

 

Reference

How to remove the suspend and lock button from menu in ubuntu 17.04?

Explanation of file - org.freedesktop.login1.policy

 

 

文字內容 或 影像內容 部份參考、引用自網路,如有侵權,請告知。

 

 

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 silverwind1982 的頭像
    silverwind1982

    拾人牙慧

    silverwind1982 發表在 痞客邦 留言(0) 人氣()