How to add the Guest Session feature in Ubuntu desktop

Woman working on her laptop in an office

Carlina Teteris/Getty Images

Your privacy is important and nearly every Linux distribution is filled with features, tricks, and underpinnings that take the security of your information very seriously. Take, for instance, the idea of the guest session. 

Imagine you had a special login for your operating system that would allow others to use the machine, without having access to any of your data. At the same time, no information would be saved between guest sessions. In other words, anyone could use your computer, and — once they log out of the guest session — any and all data they collected during the session would be automatically trashed.

Also: Ubuntu 22.04.2 is as predictable as an operating system can be… and that's a good thing 

That's why the guest session should be considered important to anyone who randomly (or regularly) has to share a computer with other users. This could even be employed by small businesses that need kiosk-like computers for customers to use.

Although Ubuntu doesn't ship with this feature enabled by default, it's pretty easy to add. Let me show you how to do just that.

How to enable Guest Session

Requirements

The only things you'll need for this are a running instance of Ubuntu desktop (from 16.04 to the latest release) and a user with sudo privileges. That's all you need. Let's make it happen.

The first thing we must do is install the LightDM login manager. Log in to Ubuntu and open a terminal window. At the prompt, paste the following command:

sudo apt-get install lightdm -y

During the installation of LightDM, you'll be prompted to select the default login manager. 

Also: Ubuntu Linux tries for the office desktop

Using the arrow keys on your keyboard, select lightdm, tab down to Ok, and hit Enter on your keyboard.

The LightDM configuration window.

You must select lightdm as your default login manager to enable Guest Session.

Screenshot by Jack Wallen/ZDNET

Once LightDM is installed, you must configure it to enable the Guest Session feature. For that, issue the command:

sudo nano /etc/lightdm/lightdm.conf.d/40-enable-guest.conf

In that file, paste the following contents:

[Seat:*]
allow-guest=true

Save the file with the [Ctrl]+[X] keyboard combination.

With the LightDM software installed and configured, reboot the machine. Once the login manager appears, you'll see Guest Session listed. To use the new feature, click Guest Session, and then click Log In. There is no password for the Guest Session. 

Also: How to install Ubuntu Linux (It's easy!)

Once the desktop is presented, the user will be presented with a warning that all data created during the session will be deleted upon log out and that, should they need to save any data, it should be saved to an external device (such as a USB flash drive).

The LightDM log in manager with guest session enabled.

Click Guest Session and you'll then be prompted to click Login.

Screenshot by Jack Wallen/ZDNET

The Guest Session will look and feel like a regular session and even has a home directory. One thing to keep in mind, however, is that every single time you enter the Guest Session, you'll see the Temporary Guest Session warning and will have to walk through the welcome wizard.

If that becomes problematic, you can remove the initial setup tool with the command:

sudo apt remove --autoremove gnome-initial-setup

Of course, the above command must be run as a regular user with sudo privileges. However, once the command completes, log out, and log back in to the Guest Session account. You'll still see the Temporary Guest Session warning, but not the initial setup wizard.

The guest session warning informing users no data will be saved.

Every guest user will see this warning.

Screenshot by Jack Wallen/ZDNET

And that, my Linux-using friends, is how you can enable the Guest Session account and retain your privacy, no matter how many people need to use your computer.

Source