How to Change Hibernate and Suspend Settings in Xfce

xfce

I've found the following commands :

xfconf-query -c xfce4-session -np '/shutdown/ShowSuspend' -t 'bool' -s 'false'
xfconf-query -c xfce4-session -np '/shutdown/ShowHibernate' -t 'bool' -s 'false'

To disable suspend and hibernate button from Xfce.

However those commands only effect the user that runs them.

How can I set those parameters system wide ? (all users : new and existing)

I've found that the purpose of /etc/skel is for all new users but I can't find information on how to use it with Xfce settings … and it impacts only new users.

Best Answer

Often for multi-user systems or for special purposes, Xfce kiosk mode is used so that you can disable all shutdown options for users such as hibernate and suspend. I am running Xubuntu 12.04, but with the ppas for Xfce 4.10 and 4.12. I think there were some issues with kiosk mode a while ago, but it seems to work again now, at least in my tests (see the before and after screenshots below).

Kiosk mode does not need any additional downloads or installations, but will only take effect if you have /etc/xdg/xfce4/kiosk/kioskrc, so first run

sudo mkdir /etc/xdg/xfce4/kiosk
sudo touch /etc/xdg/xfce4/kiosk/kioskrc

There can be several sections of the kioskrc file, but we will concentrate on xfce4-session, as those are the settings you require. The official documentation is useful in explaining the options available for xfce4-session, but below is an example of the possible content of the xfce4-session part of /etc/xdg/xfce4/kiosk/kioskrc. This would give you a really strict kiosk mode that would leave non-administrative users without any ability to shutdown the machine (or use suspend/hibernate) using the menus or via commands in terminal, although they could still logout. You may not want to use these settings, this is just an example (see below for further explanation):

[xfce4-session]
CustomizeSplash=NONE
CustomizeChooser=NONE
CustomizeLogout=NONE
CustomizeCompatibility=NONE
Shutdown=NONE
CustomizeSecurity=NONE

In place of Shutdown=NONE and other settings, you could very reasonably specify your own main user (e.g. Shutdown=mike), so only you still have the ability to suspend/shutdown using the menu (without resorting to using sudo with command-line shutdown equivalents), but it depends on your purposes. If you want to specify groups use %groupname, and for users just specify username; the settings ALL and NONE are self explanatory.

Open the kioskrc with your text editor:

sudo nano /etc/xdg/xfce4/kiosk/kioskrc

Then copy the above block of settings for xfce4-session, making sure that you alter the values to suit your purposes. Then save the file, logout and login again with your user or another user to test the settings.

My example of 'before and after' with the strictest kiosk mode settings, which will apply to all users:

a) Before with normal Xfce settings, running as user mike:

enter image description here

b) After, with kiosk mode and strict settings enabled, running as user mike:

enter image description here

For more information, please see the Xfce documentation.