By default, when you enter a guest session, the desktop looks like it does when a regular user logs in for the first time. This tutorial shows how a system owner can customize the guest session feature to change the appearance and behavior.

Hooks facilitate customization

This section is intended for advanced users. If you find it somewhat esoteric, just skip it and continue to the next section. Wink ;-)

When you launch a guest session, a temporary user account, whose home directory is located in /tmp, is created behind the scenes. To customize the feature, we need to control the contents of that home directory, and the source code includes a couple of 'hooks' for the purpose:

  • If the directory /etc/guest-session/skel exists and is not empty, its contents is copied to the home directory of the temporary user account. Otherwise the files in /etc/skel are copied.

  • If the file /etc/guest-session/ exists, it's sourced by /usr/sbin/guest-account. /etc/guest-session/ is intended for commands that modify the contents of the home directory.

    While $USER refers to "guest-XXXXXX" and $HOME to the home directory of the temporary account, the process that runs
    /usr/sbin/guest-account is privileged. Hence the last command in /etc/guest-session/ should be

    chown -R $USER: $HOME

    so the guest user, and not root, becomes the owner of the files and directories you create via /etc/guest-session/ (The command is not needed in Ubuntu 14.04 and later version.)

  • As from Ubuntu 14.04, if the file /etc/guest-session/ exists, it's sourced by the autostarted
    /usr/lib/lightdm/ script. /etc/guest-session/ can be used to e.g. launch programs automatically at startup.

Special purpose user

Using a special user account for setting the guest preferences is the most convenient way to customize the guest session feature. Please follow these steps:

  1. Add a new user account with the username guest-prefs.

  2. Log in to guest-prefs and change things to what you want your guests encounter at startup.

  3. Open a terminal window and create a symbolic link to the home directory of guest-prefs:

    sudo mkdir /etc/guest-session
    sudo ln -s /home/guest-prefs /etc/guest-session/skel

Now, when you launch a guest session, it will have the same preferences as you set for guest-prefs.


  • In this tutorial we use the name guest-prefs, but you can give the special purpose user some other username.

  • You may prefer to hide guest-prefs from the login screen and the system menu. Hopefully that will be easy to accomplish when has been fixed.

Startup dialog

As from Ubuntu 14.04, when you launch a guest session, a dialog window shows up that alerts you about the temporary nature of the session.


It's considered desirable that the window gets focused, so it's started with a 4 seconds delay. Whether those 4 seconds are sufficient is affected by for instance how powerful the computer is and which programs are automatically launched at startup.

Modify dialog delay time

To set 8 seconds delay time, create or open the file /etc/guest-session/ and insert this line:

echo "export DIALOG_SLEEP=8" >> $HOME/.profile

Disable startup dialog

If you prefer that the dialog does not show up at all, create or open the file /etc/guest-session/ and insert this line:

touch $HOME/.skip-guest-warning-dialog

Save files on disk

For the case you want to offer your guests the possibility to store files persistently on disk (not permitted by default), you can create the folder /var/guest-data:

sudo mkdir -m 0777 /var/guest-data

That folder is mentioned in the startup dialog if it exists and is world writable.

Add guest to additional user group

By default the guest user only belongs to a temporary user group with the same name as the user. To add the guest to the group mygroup (must be an existing group), create or open the file /etc/guest-session/ and insert this line:

adduser $USER mygroup

Language selection dialog

Normally the display language is fixated to either the default system language (as specified in the /etc/default/locale file) or the language the system owner specified using the customization methods described above. However, it's possible on a multilingual system to let the guest select the language when launching a guest session.

You can use a wrapper script to let the user choose display language via a Zenity dialog. Hence zenity needs to be installed, and also the languages you include in the script, of course. The example script below includes English and Swedish.

  1. Create /etc/guest-session/, give it this contents:

    #!/bin/sh -e
    # show zenity dialog only when launched from greeter
    for U in $(users); do
        if [ "${U%%-*}" != 'guest' ]; then
    if $ONLYGUEST && [ -x /usr/bin/zenity ]; then
        guestlang=$( zenity --list --title 'Select language' \
          --text 'Select language for the guest session' --radiolist \
          --column 'Pick' --column '' TRUE 'English' FALSE 'Swedish' )
        if [ "$guestlang" = 'English' ]; then
            echo 'export LANGUAGE=en_US' >> "$HOME/.profile"
            echo 'export LANG=en_US.UTF-8' >> "$HOME/.profile"
        elif [ "$guestlang" = 'Swedish' ]; then
            echo 'export LANGUAGE=sv' >> "$HOME/.profile"
            echo 'export LANG=sv_SE.UTF-8' >> "$HOME/.profile"
    exec /usr/lib/lightdm/lightdm-guest-session "$@"

    and make it executable:

    sudo chmod +x /etc/guest-session/
  2. Enable the wrapper script by creating the file /etc/lightdm/lightdm.conf.d/50-choose-guest-language.conf and give it this contents:


After next reboot the zenity dialog should show up when launching a guest session from the greeter.

See also

  1. Launch a restricted guest session - Official guest session documentation.

  2. CustomizeGuestSession/old - Deprecated predecessor of this tutorial.
    Even if the old tutorial is deprecated, the page and the tarballs contain code snippets that might serve as examples for the case you choose to set the guest preferences via /etc/guest-session/ and/or /etc/guest-session/ instead of creating a special user account for the purpose.


CustomizeGuestSession (last edited 2016-11-23 14:57:22 by gunnarhj)