Page 1 of 5 123 ... LastLast
Results 1 to 10 of 49

Thread: Customize guest session

  1. #1
    Join Date
    Aug 2010
    Location
    Goteborg, Sweden
    Beans
    24
    Distro
    Ubuntu 13.10 Saucy Salamander

    Customize guest session: guest-session-prefs and guest-session-prefs-lightdm

    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:

    1. guest-session-prefs-0.13.tar.gz - for Ubuntu < 11.10 with GDM
    2. guest-session-prefs-lightdm-0.12.tar.gz - for Ubuntu >= 11.10 with LightDM

    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 file
    tar -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:

    /etc/guest-session/auto.sh
    /etc/guest-session/prefs.sh
    /etc/guest-session/prepare.sh
    /etc/guest-session/sv/LC_MESSAGES/guest-session-prefs.mo
    /usr/share/doc/gdm-guest-session/guest-session-prefs/README
    /usr/share/doc/gdm-guest-session/guest-session-prefs/sample-translation.po
    /usr/share/doc/gdm-guest-session/guest-session-prefs/uninstall.sh
    /usr/share/gdm/guest-session/guest-session-auto.sh


    You launch a guest session by calling
    /usr/share/gdm/guest-session/guest-session-launch
    or, as from Ubuntu 11.04, just
    guest-session
    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.

    To uninstall guest-session-prefs you do:
    cd /usr/share/doc/gdm-guest-session/guest-session-prefs
    sudo ./uninstall.sh
    Comments

    Firefox

    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.

    Code:
    echo 'user_pref("signon.rememberSignons", false);' >> $profiledir/user.js
    That code tells Firefox to not prompt about remembering passwords. At the page Customizing Mozilla you find some other customizing hints.


    Disabling certain applications

    guest-session-setup.sh disables a few services that are unnecessary for guest sessions. Applying the same approach, prefs.sh defines the function disable_app(). This is how I disable the login sound:

    Code:
    disable_app libcanberra-login-sound.desktop /usr/share/gnome/autostart
    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/*:
    sudo mkdir -p /etc/guest-session
    sudo cp -ri /etc/skel /etc/guest-session
    In comment #23, Paul has elaborated this approach by providing a step-by-step guide. Thanks, Paul!

    Related bug

    I have submitted the bug Premature lock when launching guest session, whose implementation would support this approach to customizing guest sessions.
    Attached Files Attached Files
    Last edited by Gunnar Hjalmarsson; January 29th, 2014 at 01:27 AM. Reason: Deprecation note

  2. #2
    Join Date
    Dec 2010
    Beans
    2

    Re: Customize guest session

    That was very interesting and useful, thank you.

  3. #3
    Join Date
    Aug 2010
    Location
    Goteborg, Sweden
    Beans
    24
    Distro
    Ubuntu 13.10 Saucy Salamander

    Re: Customize guest session

    Quote Originally Posted by tinche View Post
    That was very interesting and useful, thank you.
    Thanks, glad to hear you say that. You're welcome.
    Please feel free to post your comments, other customization ideas, etc.

  4. #4
    Join Date
    Sep 2007
    Location
    Nomadic
    Beans
    197
    Distro
    Ubuntu

    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.
    Love & joy - Callum

  5. #5
    Join Date
    Aug 2010
    Location
    Goteborg, Sweden
    Beans
    24
    Distro
    Ubuntu 13.10 Saucy Salamander

    Re: Customize guest session: guest-session-prefs

    Hello,

    Quote Originally Posted by chmac View Post
    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.

    Quote Originally Posted by chmac View Post
    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.

    You can also ask a question at https://answers.launchpad.net/ubuntu

    Quote Originally Posted by chmac View Post
    I'm not sure why or how sound is related to the guest session, I'm really just guessing.
    Me too, I'm afraid. Good luck!

  6. #6
    Join Date
    Sep 2007
    Location
    Nomadic
    Beans
    197
    Distro
    Ubuntu

    Re: Customize guest session: guest-session-prefs

    Turns out adding myself to the audio group seemed to resolve the problems. I can now play music from a terminal whether or not the guest session is running or not. Happy days.
    Love & joy - Callum

  7. #7
    Join Date
    Feb 2006
    Location
    Oakland, CA
    Beans
    65
    Distro
    Ubuntu

    Re: Customize guest session

    Hi I have a couple of issues, and I'm wondering if this tarball will solve them?

    1. Can I select a default layout? I use US Dvorak and would like guest's default to be US (QWERTY).

    2. Is there a way to stop guest from inheriting my startup apps (like Gnome-Do and Docky?).

    EDIT: I see these are both doable with the tarball. THANKS!
    Last edited by carrett; January 28th, 2011 at 02:41 AM.
    Every hour my servant takes my temperature and gives me another.

  8. #8
    Join Date
    Aug 2010
    Location
    Goteborg, Sweden
    Beans
    24
    Distro
    Ubuntu 13.10 Saucy Salamander

    Re: Customize guest session

    Yep, the examples in /etc/guest-session/prefs.sh ought to cover what you were looking for. I'm glad that you found the examples useful, carret.

  9. #9
    Join Date
    Nov 2007
    Beans
    9

    Re: Customize guest session

    Very thoughtful post, thank you.

  10. #10
    Join Date
    Feb 2009
    Beans
    19
    Distro
    Ubuntu 10.10 Maverick Meerkat

    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?

Page 1 of 5 123 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •