Note: This tutorial is deprecated and replaced by CustomizeGuestSession.Important note+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Up to Ubuntu 11.04 the guest session feature was provided by gdm-guest-session, an extension to the GNOME Display Manager (GDM) which was the default display manager in Ubuntu. This changed in Ubuntu 11.10, where LightDM is the default display manager, and you can now launch a guest session through a built-in LightDM feature. Unlike before you don't need to first log in as a regular user; a guest session in Ubuntu 11.10 can optionally be launched directly from the login screen.

This tutorial was written with gdm-guest-session in mind. However, I have put together a new tarball file, so now there are two tarballs attached to this tutorial:

Even if the comments below refer to the first tarball, most of them apply to the new tarball as well. The names of some files and directories have been altered, but hopefully the README file in guest-session-prefs-lightdm-0.12.tar.gz contains sufficient guidance in that respect.+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Overview

Many Ubuntu users, me included, have posted ideas on minor changes to the gdm-guest-session behavior, and I'm happy to share the guest session related changes I have made. They include:

Firefox preference setting

disabling login-sound

language selection [not in LightDM]

gettexted strings

folder for storing files permanently

info dialog at startup

icon on the desktop

Whether you want to make a couple or all of those changes, or there are other changes that you would like to see, I hope that the methods used for altering the guest session behavior may serve as useful examples.

The figure below shows the most important files, and gives you a schematic picture of the program flow. In the left column you find the core files in the gdm-guest-session package (green borders) together with a tiny file that I created, merely to have all the executables located in the same folder. The files in the right column are in effect configuration files, even if they contain shell commands. Computer owners and system admins may edit the files in /etc/guest-session to their liking, without worrying about the changes being overwritten when gdm-guest-session or other packages are updated.

Some of the commands in my code snippets need to be executed before the start of the launch process, while others are better executed in the middle or at the end of the process. I grouped my snippets accordingly, so that's why there are three files in the right column.

Tarball: guest-session-prefs

There is a tarball file attached to this tutorial with both a README file and an install script, almost like a package. But since admins are expected to change and add things, guest-session-prefs is very different compared to an Ubuntu package. In the README file I call it a "convenience kit", a framework for configuring guest sessions.

I recommend that you download the tarball and run the install script. Rather than describing every detail, the comments below serve as a user guide focusing on a few edit possibilities.

Install / uninstall

Okay, here we go.

Download guest-session-prefs-0.13.tar.gz
Open a terminal window and go to the directory with the downloaded filetar -xf guest-session-prefs-0.13.tar.gz cd guest-session-prefs-0.13 sudo ./install.sh

Now you have exactly the same setup as I have (or at least had when I wrote this...). These are the installed files:

If you, like me, display a list dialog with choices when a guest session is launched, you'll notice an odd behavior if you use the guest session menu item provided by the indicator-session package. The reason is that indicator-session locks the screen before calling guest-session-launch. Creating your own launcher, e.g. via System -> Preferences -> Main Menu, solves that possible problem.

Maybe Firefox is the most used application by guests, and many admins want to be able to set some preferences. /etc/guest-session/prefs.sh contains a code snippet that creates a Firefox profile, and given the commands in that snippet, one line of code in prefs.sh is enough to change some aspect of Firefox.

libcanberra-login-sound.desktop is the file that autostarts the login sound by default, and /usr/share/gnome/autostart is the folder where that file resides.

Language selection[not applicable to LightDM]

If you launch a guest session right after having installed guest-session-prefs, you are prompted to choose between English and Swedish.

If you try the Swedish option, but still only see English on the screen, it's hopefully not a bug. A more likely explanation is that Swedish has not been installed on your system. You can set available languages via System -> Administration -> Language Support.

For those of you who want to be able to select language, the language related code ought to be useful. If one language (e.g. French) is enough, but the launching regular session might be run in some other language, the code in /etc/guest-session/prepare.sh can be exchanged for:

Code:

echo "fr_FR" > /tmp/guest-session-lang

Finally, if you have no interest in using more than one language, you can simply delete prepare.sh. OTOH, commenting out the code or renaming the file are probably better options. For instance, there may be other preferences that you want to set on-the-fly when launching a session.

Gettexted strings

To the extent you make use of text strings that are displayed to the guest user, which for instance is the case with the info dialog box shown below, you may want the strings to be translated to the current language. guest-session-prefs shows how that can be done using GNU gettext. If you have not used the gettext tools before, I believe that my example may help you get started. Of course, reading parts of the gettext manual is advisable in any case.

If you are only dealing with one non-English language, and don't care about English, it's probably easiest to drop gettext and just hard code the strings in the language of choice.

Folder for storing files permanently

I allow my guest users to store files permanently, and the install script creates the folder /var/guest-data for the purpose and assigns the permissions 0777. If you are of another view, just remove that folder.

Info dialog at startup

/etc/guest-session/auto.sh contains code for displaying an info dialog box. While calling the guest users' attention to the temporary nature of a guest session, it informs about the dedicated folder /var/guest-data for persistent file storage.

Icon on the desktop

auto.sh also creates a shortcut icon to /var/guest-data. You may want to add a few similar code snippets to auto.sh that for instance place application shortcuts on the desktop.

Alternative approach

In some respects, launching a guest session comes about similarly to creating a new regular user, so by default the files in the folder /etc/skel are copied to the guest's home folder. As from Ubuntu 11.04, gdm-guest-session uses the files in /etc/guest-session/skel if present. That way some of the above customization measures can be accomplished by editing in /etc/guest-session/skel instead of using shell commands.

You enable this feature by copying /etc/skel/* to /etc/guest-session/skel/*:

Re: Customize guest session: guest-session-prefs

Thanks for sharing this. It's a nice idea to customise the session a little.

I stumbled upon this thread by searching for a soundless guest session. When I create a guest session any music or other sound that was playing on the system stops (or pauses) and continues once I log out of the guest session. I'd like to be able to play music while a guest session is logged in. Any idea if that's possible by customising your script slightly? I'm not sure why or how sound is related to the guest session, I'm really just guessing.

I have a guest computer connected to speakers and I'd like to play music remotely via cmus on that machine, but also let guests use it for internets. I found that cmus would freeze until the guest session was finished.

Re: Customize guest session: guest-session-prefs

When I create a guest session any music or other sound that was playing on the system stops (or pauses) and continues once I log out of the guest session.

I'm not able to reproduce that behavior. To me, music that was playing in a regular session keeps playing if I launch a guest session.

Originally Posted by chmac

I'd like to be able to play music while a guest session is logged in. Any idea if that's possible by customising your script slightly?

No. That is I have no idea.

I noticed that there was an audio related change not very long ago. If you are using 10.04 or older, you may want to try applying that change to your copy of /etc/apparmor.d/gdm-guest-session and reboot.

Re: Customize guest session

Re: Customize guest session

Nice! This will be very helpful. I'm trying to figure out how to allow logging into a Guest session without logging in as anyone else first. ie. GDM would present you with the choice of Guest or Admin, or maybe just automatically log Guest in. Any ideas?