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

Solution 1:

Found solution from Explanation of file - org.freedesktop.login1.policy - Unix & Linux

Open file explorer with sudo privileges.

sudo -H nautilus

Browse to /usr/share/polkit-1/actions/org.freedesktop.login1.policy. Make a copy of the file for restore purposes and search for each of the following.

org.freedesktop.login1.suspend
org.freedesktop.login1.suspend-multiple-sessions       org.freedesktop.login1.suspend-ignore-inhibit       org.freedesktop.login1.hibernate
org.freedesktop.login1.hibernate-multiple-sessions
org.freedesktop.login1.hibernate-ignore-inhibit

For each of the above action id scroll down past the translations to change the following from yes to no

<defaults>
     <allow_any>no</allow_any>
     <allow_inactive>no</allow_inactive>
     <allow_active>no</allow_active>
</defaults>

Save and reboot.