10

We are working with a terminal server that is running Xubuntu. Because we have had some issues with saved sessions, we want to turn off the saving of sessions completely.

So far, we have been able to set the default to not saving the session, but in the logout screen it is still possible to save the session. Is it possible to turn off session saving completely (system-wide) so our users won't "accidentally" use it?

3 Answers 3

11

(Tested with Xubuntu 12.04, but with the ppas for Xfce 4.10 and 4.12 installed, but the option I discuss was available for Xfce 4.8)

There is a way to globally disable the option of saving the session, and the best way to achieve it is to use Xfce kiosk mode. One of the available kiosk mode options, buried in the source code for xfce4-session, is SaveSession. If we look at /home/mike/xfce4-session-4.10.0/xfce4-session/xfsm-shutdown.c, we can see the undocumented setting:

/* check kiosk */
  shutdown->kiosk_can_save_session = xfce_kiosk_query (kiosk, "SaveSession");

Firstly, create the kiosk directory with

sudo mkdir /etc/xdg/xfce4/kiosk

and then create and edit the kioskrc with your text editor:

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

Place the following in your kioskrc:

[xfce4-session]
SaveSession=NONE

Now, save the changes and logout and login again as your user to test it. The checkbox option to save the session should have disappeared.

Before the setting is applied, the box is still available:

enter image description here

Afterwards, with kiosk mode active, the option is no longer available:

enter image description here

If you wish to use kiosk mode to globally disable other settings, such as the ability to shutdown or suspend, etc, see my answer here:

7
  • Sorry for taking so long to accept, I didn't want to accept without having tried it out, and I wasn't doing maintenance on that server again until now.
    – Jasper
    Jun 1, 2013 at 13:11
  • It seems that it doesn't work anymore with 4.10.1-1ubuntu1 under Xubuntu 13.10. Before the upgrade everything was ok :-( Nov 12, 2013 at 22:35
  • @DanielAlder It still seems to work for me, as I am using the Xfce 4.10 ppa on 12.04; the update you mention is the Xubuntu 13.10 update I think. The kiosk option still seems to be enabled in the source and there are no patches disabling it, so it's very strange.
    – user76204
    Nov 14, 2013 at 0:37
  • @Mik: the kioskrc still hides the 'save session' button, but funnily one out of 4 times after logging out and in the open windows which I had come back. Nov 14, 2013 at 22:07
  • @DanielAlder Yes, this can still happen, even if saving sessions is disabled in settings > settings-manager > session and startup > session. You can get rid of any remnants from other sessions by clicking 'clear saved sessions' and then the windows won't come back. The session behaviour of xfce can be a bit odd sometimes, and I'm sure I remember a general bug being filed in the past about it.
    – user76204
    Nov 16, 2013 at 10:49
1

the hack from misterich didn't do the trick for me either, somehow it still can write to sessions folder

my solution:

  1. rm -rf "$HOME/.cache/sessions"

  2. touch "$HOME/.cache/sessions"

now there is a file named sessions instead of sessions folder therefore it can't write file to it anymore.

0

I ran into the very same problem, but the solution provided by @user76204 didn't do the trick for me.

My Details

$ uname -ir && lsb_release -a && xfce4-about -V

3.13.0-24-generic x86_64 No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04 LTS Release: 14.04 Codename: trusty xfce4-about 4.11.1 (Xfce 4.10)

My Solution

I fully admit that this is an ugly, ugly hack

  1. Clear out the sessions directory:
    find "$HOME/.cache/sessions" -type f -print0 | xargs -0 rm -f
  2. Remove write permissions by setting octal permissions on "$HOME/.cache/sessions"
    chmod 500 "$HOME/.cache/sessions"

Thus, sessions cannot be saved. This approach does have one advantage, however: Should you want something set in a session at a later date:

  1. Reset the permissions on the folder
    chmod 700 "$HOME/.cache/sessions"
  2. Fire up XFCE session manager:
    xfce4-session &
  3. set/save/configure whatever...
  4. Save the session
  5. Remove write permissions by setting octal permissions on "$HOME/.cache/sessions"
    chmod 500 "$HOME/.cache/sessions"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .