How to disable ubuntu’s guest session account

Chris Hoffman
How to disable ubuntu’s guest session accountChris Hoffman
Editor-in-Chief

Chris Hoffman is Editor-in-Chief of How-To Geek. He’s written about technology for over a decade and was a PCWorld columnist for two years. Chris has written for The New York Times, been interviewed as a technology expert on TV stations like Miami’s NBC 6, and had his work covered by news outlets like the BBC. Since 2011, Chris has written over 2,000 articles that have been read nearly one billion times—and that’s just here at How-To Geek. Read more.

How to disable ubuntu’s guest session account

Ubuntu and Linux Mint come with a “Guest Session” account, which anyone can log into from the login screen – no password required. If you’d rather restrict access to your computer, you can disable the guest account.

This guest account is locked down and changes to it don’t persist between sessions – everyone that logs in gets a fresh desktop. Still, you may want to disable it to prevent other people from using your computer.

Disabling the Guest Account

Ubuntu doesn’t expose an easy option to disable this feature. If you poke around the User Accounts configuration tool, where you might expect to find such an option, you won’t find one. To disable it, we’ll have to edit lightdm.conf, which controls the LightDM display manager (login screen)’s settings.

Open LightDM’s configuration file in a text editor by pressing Alt+F2, typing the following command, and pressing Enter:

How to disable ubuntu’s guest session account

You’ll be prompted to enter your password. After you do, you’ll see the contents of the file.

How to disable ubuntu’s guest session account

Add the following line to the end of the file, in the [SeatDefaults] section:

Save the file after adding the line.

How to disable ubuntu’s guest session account

The changes will take effect when you restart your computer. You can also run the following command in a terminal to restart LightDM and have the changes take effect without restarting your system:

Warning: Running this command will restart your graphical desktop environment. All open graphical programs will close and you’ll lose unsaved work in all of them.

How to disable ubuntu’s guest session account

After restarting the computer or running the command, the Guest Session will vanish from your login screen.

How to disable ubuntu’s guest session account

Re-Enabling the Guest Account

To re-enable the guest account in the future, run the gksu gedit /etc/lightdm/lightdm.conf command again and remove the allow-guest=false line from the file. After you do, save it and restart your computer (or run the above sudo restart lightdm command) and the guest account will re-appear.

  • › How to Show Your Work Hours and Location in Google Calendar
  • › You Can Finally Move WhatsApp Chats From iPhone to Android
  • › How to Print Double-Sided on Windows 11
  • › Samsung Galaxy Phones Are Getting Grammarly Installed by Default
  • › How to Enable Cookies in Google Chrome

How to disable ubuntu’s guest session account Chris Hoffman
Chris Hoffman is Editor-in-Chief of How-To Geek. He’s written about technology for over a decade and was a PCWorld columnist for two years. Chris has written for The New York Times, been interviewed as a technology expert on TV stations like Miami’s NBC 6, and had his work covered by news outlets like the BBC. Since 2011, Chris has written over 2,000 articles that have been read nearly one billion times—and that’s just here at How-To Geek.
Read Full Bio »

Ubuntu comes with one additional account that you had not created, that’s what called as Guest account/ session. Through Guest account, an unauthorized or you can say, anyone with whom you are not willing to share your Ubuntu system, may enter and use it, if the system’s screen is unlocked. However, your private folders will not be accessible to any guest user. But, to be on a safer side, it is recommended to disable the Guest account.

In my own system, the Trusty Tahr i.e. Ubuntu 14.04 LTS (Long Term Support) is installed and what I have examined is that there’s no “/usr/lib/lightdm/lightdm-set-defaults” command, to edit the “Lightdm” configuration file. Now, you may be thinking of what is the use of it? Guys, we are going to disable the Guest account, right! For that, we have to perform some changes in “lightdm.conf” file which was available under the “usr/lib” in the previous versions of Ubuntu.

Well, it’s not the thing to worry about, we”ll create it. Coming to the Lightdm, it is the indispensable X-display manager for Linux systems. X-display manager shows you the login screen that usually prompts for the login credentials. Lightdm provides the well-structured linking with the user interface and the X-server.

I hope you have understood the importance of “Lightdm”. So, in order to create and edit the “lightdm.conf” file, you must look at this article, where you will learn how to disable & enable Guest user account in Ubuntu by following the steps as explained below.

Steps to Disable & Enable Guest User Account in Ubuntu

To Disable the Guest account

Step 1: Firstly, open up the shell Terminal by pressing “Ctrl +Alt + T”. I have already told you that in this version, there’s no “lightdm” commands. To edit the “conf” file of Lightdm, the major requirement is to create the“lightdm.conf” file under “/etc” which is a directory in Ubuntu.

The etc stands for ‘etcetera’ which means “where everything else goes”. It’s better to create system files under this directory. Just type “sudo touch /etc/lightdm/lightdm.conf” and press enter.

If you are not a root user then only use “sudo” otherwise not.

How to disable ubuntu’s guest session account

Step 2: Configuration file is now created. You need to edit it, for that you can use the editors such as vim, gedit or using cat command. Here, we will do it by using the “gedit”, the editor comes by default in the shell.

So, type “sudo gedit /etc/lightdm/lightdm.conf” and press enter.

How to disable ubuntu’s guest session account

Step 3: File gets opened in the respective editor. Then, add the lines written below, just copy paste it from here and save the changes.
[SeatDefaults]
greeter-session=unity-greeter
user-session=ubuntu
allow-guest=false

The meaning of “Greeter” over here is, the name of the login screen application in Ubuntu. In fact, the greeter is one of the Lightdm themes. It can be used with unity, kde desktop.

How to disable ubuntu’s guest session account

Step 4: Back to the terminal, here you may notice some of the warnings such as IBUS-Warning, Gtk-Warning. That doesn’t matter, you can proceed with restarting the lightdm. So, type “sudo restart lightdm” and press enter.

How to disable ubuntu’s guest session account

Step 5: Once the system restarts, you would find that “Guest Session” is no more available on the login screen. It means you have successfully achieved what you wanted.

How to disable ubuntu’s guest session account

To Enable the Guest Account:

Step 6: Open the file named “lightdm.conf” as stated in the step 3. Then remove the line “allow guest=false” and then click on “Save” button to make the changes.

How to disable ubuntu’s guest session account

Step 7: Restart your Ubuntu system. At the login screen, you will notice that Guest Session is now enabled.

How to disable ubuntu’s guest session account

Stay Tuned with QueHow! For the latest articles about how-to?

How to disable ubuntu’s guest session account

Ubuntu and Linux Mint come with a default guest user account that does not require a password. In this tutorial, we shall see how to disable guest account in Ubuntu 16.04 and 14.04.

What is the guest account in Ubuntu?

Before going further let’s talk about guest user accounts and why or why not you should disable a guest account.

How do you feel when someone asks to use your personal computer? Are you skeptical of what that person might do with your computer, your personal data and settings?

This is where guest user account comes in picture. It gives anyone temporary access to your computer without putting your digital data at risk. A guest user can access internet but cannot change settings. As soon as the guest user logs off, your computer is restored back to the state it was in, largely. Moreover, it does not require any password to login.

Talking of passwords, you should know that it is really easy to hack Ubuntu admin passwords.

But how often does guest accounts come in use? For me, I am the only user of my laptop and the guest session have never been used in my system. Then why should I keep it? I would rather prefer to disable the guest account from Ubuntu and prevent it from showing in login screen.

You may have your own reasons to not use guest sessions. Let’s see how can we disable guest account session in Ubuntu Linux.

How to disable guest account in Ubuntu:

We’ll see two command line trick to disable guest account Ubuntu 14.04 and 16.04.

Solution 1:

Open the terminal (Ctrl+Alt+T) and use the following command to disable the guest session:

To re-enable guest session, use the same command but with option true this time.

Solution 2:

If you are not comfortable with the commands above then you can configure lightdm to disable the guest session. Use the following commands to open the lightdm configuration in Gedit:

Change the following line to false in the file and save it:

How to disable ubuntu’s guest session account

allow-guest=false Restart lightdm to see the effect or restart your computer.

That’s it. You won’t be troubled with guest sessions anymore. I hope this tutorial helps you to disable guest account in Ubuntu Linux. Regularly visit us to learn more tricks and tips on Ubuntu.

How do I disable the guest session in Ubuntu 11.10 or higher? I don’t want people to be able to use my computer without using a password to log in!

12 Answers 12

  • System provided configuration files in /usr/share/lightdm/ are not intended to be user editable. Instead users should use: /etc/lightdm/
  • Newer versions of LightDM (Ubuntu 15.10, or later) use [Seat:*] instead of [SeatDefaults]

Just run this (once) at terminal:

To undo (restore Guest option), remove the file created:

Just run this (once) at terminal:

You will no longer have ‘Guest’ as login option, on your next login.

To undo (restore Guest option), remove the file created:

Simplest method.

Just run this (once) at terminal:

You will no longer have ‘Guest’ as login option, on your next login.

This simply appends allow-guest=false to /etc/lightdm/lightdm.conf .

Should work from 11.10 onwards (since these use LightDM as well).

To undo (restore Guest option):

Only use this method if you are using Ubuntu Desktop. If you are using another flavour such as Xubuntu or Lubuntu please refer to this answer instead.

If you’re using the default LightDM, edit /etc/lightdm/lightdm.conf so that it looks like this:

If you’re using GDM (which was the default in previous Ubuntu releases), uninstall gdm-guest-session.

How to disable ubuntu’s guest session account

If you’re an Ubuntu 12.04 LTS or the 12.10/12.x user, you might notice a new ‘Guest Session’ feature on your login screen. While the guest account does not pose a security threat, this could let anyone use your computer. If you prefer not to allow guest users on your computer, this simple guide will help you to. It cannot be disabled via the ‘User Accounts’ tool in ‘System Settings’, but it’s pretty simple following the quick steps below.

LightDM is responsible for the login screen and we shall be modifying the LightDM Configuration file to add a boolean value, and finally restart the LightDM service.

To start with, open up Terminal (CTRL + ALT + T) or press ALT + F2 and type in the following command

gksu gedit /etc/lightdm/lightdm.conf

You will now have to authenticate yourself. Type in your password and proceed. You’ll be displayed the file’s contents on gedit.

And now, in the [SeatsDefault] section, add the following line and save the file.

You have now instructed not to allow guest sessions on your ubuntu machine. For the setting to take effect, you will either have to restart your machine, or swiftly restart the LightDM service alone. We’ll take the quick method of restarting LightDM. To do so, type the following in your Terminal and press Enter.

sudo restart lightdm

You have instructed your machine to restart LightDM. From now, you shouldn’t be noticing guest session while you login.

How to disable ubuntu’s guest session account

Ubuntu and Linux Mint possess a feature known as “Guest Session” account, which almost anyone and everyone can log in from the login screen itself– no password demanded for. This guest account is temporary, once session is terminated any modification performed in that session lost so if anyone logs into the system again with a new guest session account, the user will be provided a new desktop. Yet if you intend to limit access to your computer, then a best solution is to disable / remove Ubuntu Guest Session Account.

Steps to Disable / Remove Ubuntu Guest Session Account?

Ubuntu doesn’t show you a fast and easy choice to switch off this feature. If you play around with the User Accounts configuration tool, where you might think that such an option would be present, then certainly you are in the wrong track. To disable it, we need to modify lightdm.conf, which commands over the LightDM display manager settings, which is also the login screen commander.

1. Open up LightDM’s configuration file in a text editor by tapping the keys Alt+F2, and type in the following command, and pressing Enter:

$gksu gedit /etc/lightdm/lightdm.conf

How to disable ubuntu’s guest session account

2. You will be asked to provide the password, enter the password. You will now able to view/edit the file.

How to disable ubuntu’s guest session account

3. Just include the following line to the end of the file, in the [SeatDefaults] section:

Save the file after including the above line.

How to disable ubuntu’s guest session account

4. Now, you need to restart the system or you may execute the following command in a terminal to restart LightDM itself and view the modification in place even without restarting your system:

$sudo restart lightdm

How to disable ubuntu’s guest session account

After restarting the computer or executing the above command, the Guest Session will disappear from your login screen

This website needs your consent to use cookies in order to customize ads and content.

If you give us your consent, data may be shared with Google.

  1. Accept

How to remove guest session from the login options on ubuntu.

Edited: 2017-04-10 21:43

How to disable ubuntu’s guest session account

To disable the guest session account on Ubuntu, the first place one would expect to look, is in the account manegment tool – but for some reason the option is missing – fear not! All you need to do, is to edit the /etc/lightdm/lightdm.conf file in you ubuntu installation.

To edit the lightdm.conf file, simply open a new terminal window and enter the below command:

Doing this will pompt you for your password to edit the file. After typing your password, you can edit the file. The content of the file should look like below:

Now, to disable the guest option from the login screen, simply place the following somewhere last in the file.

Thee are two ways to make the changes thake effect, either you need to reboot your computer – which is a small inconviance – espicially if your disk is encrypted, and you need to re-enter your encryption key on each reboot – the other way is to restart lightdm by entering the below command

If you later want to re-enable your guest account, all you need to do is to go through all the above steps, only backwards.

Video

How to disable ubuntu’s guest session account

If you have not noticed, at the login screen of Ubuntu, anyone can select the “Guest Session” and login to your computer without password. Of course, the guest won’t be able to access your files and folders. What they will see is the default Ubuntu desktop and they won’t be able to store any file permanently as all saved files are deleted on reboot. The guest session is great if you are borrowing someone your laptop for a quick email check or web browsing. However, if you are the only user of your computer and you hate the “Guest Session” option cluttering up your login screen, here is how you can disable guest account in Ubuntu.

1. Login to your computer with your personal account. Open a terminal and type the following:

You should see the following:

How to disable ubuntu’s guest session account

2. Move the cursor to a new line at the end and enter the following line:

How to disable ubuntu’s guest session account

3. Press “Ctrl +o” to save the changes and “Ctrl + x” to exit.

4. Restart Lightdm.

Alternatively, you can restart the computer. On the next login, the “Guest Session” mode will no longer show up in the login option.

How to disable ubuntu’s guest session account

More Configuration

If you want to disable the “remote login” option as well, add the following line to the lightdm.conf file.

How to disable ubuntu’s guest session account

Don’t forget to restart Lightdm

How to disable ubuntu’s guest session account

Restoration

To restore the login screen to the default state, simply undo the changes you have made. That means, remove the line “ allow-guest=false ” or “ greeter-show-remote-login=false ” from the lightdm.conf file.

Damien Oh started writing tech articles since 2007 and has over 10 years of experience in the tech industry. He is proficient in Windows, Linux, Mac, Android and iOS, and worked as a part time WordPress Developer. He is currently the owner and Editor-in-Chief of Make Tech Easier.

You may not want anyone to use your computer without your permission. But Ubuntu favors your friends and others who may want to use your computer in your absence without making any changes to your files by using the guest session provided. The guest account can be unnecessary for you is you are the only one using the computer.

This is how you can disable and enable it if you want to at a later time.

1. Open Terminal

2. Copy and Paste the command below:

How to disable ubuntu’s guest session account

3. This opens a gedit window.

How to disable ubuntu’s guest session account

4. Copy and paste this below the last line:

5. Save file and close.

How to disable ubuntu’s guest session account

6. Restart computer to see the Guess Session disabled from your log in screen and settings menu.

To Enable Guest Session.

7. Repeat the Steps above and at Step 4 remove the code you have added below the last line previously.

How to disable ubuntu’s guest session account

A guest session on Ubuntu allows having a temporary user account and access the Ubuntu machine. The desktop of a guest session looks like it does when a regular user logs in. Behind the scenes, Ubuntu controls the access privileges for a guest session.

The official definition of guest session goes as follow: This package adds support for starting a guest session through gdm’s flexiserver, which any already logged in user can launch. It creates a temporary guest account with a temporary home directory and some restricted privileges (such as not being able to read any home directory or do any permanent change to the system).

However, you would like to disable the guest session feature for some reason. This how-to tutorial will tell you how to disable/enable guest sessions on Ubuntu 16.04 LTS.

How to disable ubuntu’s guest session account

Step 1. Open a terminal session (Control+Alt+T) and go to lightdm configuration directory /etc/lightdm/lightdm.conf.d

Step 2. With sudo access, using vi editor open a file with name 50-no-guest.conf as follows:

How to disable ubuntu’s guest session account

remove guest session

Step 3: When the new file opens, add below lines and exit after saving the file.

How to disable ubuntu’s guest session account

This will create the new file name 50-no-guest.conf in /etc/lightdm/lightdm.conf.d directory.

How to disable ubuntu’s guest session account

Step 4: Restart the machine, that’s it. You won’t see guest sessions anymore on the Ubuntu.

How to disable ubuntu’s guest session account

guest session

In case you would like to restore the guest session, just remove the file 50-no-guest.conf from the directory /etc/lightdm/lightdm.conf.d and restart the machine. You will get the guest session back!

Conclusion

​Anyone who uses the guest session to sign in to your Ubuntu machine has no privileges to change the file belonging to other users. However, there was a security issue reported earlier with a lightdm package that allows a guest user to access restricted files of the system. You may feel that having a guest account does not make sense when you know that you are the only person who accesses your Ubuntu machine. In either case, I hope this tutorial helps you to get rid of the guest account.