Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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!

share|improve this question
    
Nope. Why do you want it disabled anyway? –  mikewhatever Oct 21 '12 at 17:34
7  
Can't you really think of any use case where one would want to disable the guest account? :P In my case, I'm the only one working on my PC so it doesn't make any sense for me to have it enabled. And I can think of other scenarios as well, but would go offtopic I guess :) –  Nejest Oct 21 '12 at 17:43
    
I've flagged this to be merged with the previous question so we have them all in one place, nice work everyone! –  Jorge Castro Oct 22 '12 at 0:01
    
nice catch, @JorgeCastro, thanks. –  Eliran Malka Oct 22 '12 at 0:32
    
@mikewhatever - LightDM is a desktop manager, not a security manager. It as no business doing anything security and user related. Breaking the Unix security model should be enough. But if its not, then try searching for the security related bug reports. Folks keep accidentally breaking out of the Unity/LightDM sandbox (I filed at least two myself). What do you think an attacker could do? –  noloader Feb 17 at 12:51

12 Answers 12

up vote 79 down vote accepted

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

[SeatDefaults]
greeter-session=unity-greeter
user-session=ubuntu
allow-guest=false

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


For Ubuntu 13.10 or higher, the file has moved to /etc/lightdm/lightdm.conf.d/50-unity-greeter.conf

share|improve this answer
6  
Answer seems to be out-of-date for 13.10 –  wim Oct 22 '13 at 11:56
2  
The instructions are the same for 13.10, except that the file has moved to: /etc/lightdm/lightdm.conf.d/50-unity-greeter.conf –  Andrew Nov 5 '13 at 15:05
2  
@Andrew: It makes more sense to create a new file, e.g. /etc/lightdm/lightdm.conf.d/50-no-guest.conf. The allow-guest option is not unity-greeter specific. –  Gunnar Hjalmarsson Feb 2 at 2:58
    
@GunnarHjalmarsson: You're right. Creating a new file also ensures that your changes won't be overwritten by a package upgrade. –  Andrew 2 days ago
    
@Andrew: Indeed. ;) –  Gunnar Hjalmarsson 2 days ago

For Ubuntu 11.10, 12.04 LTS, or 13.10

Simplest method.

Just run this (once) at terminal:

sudo /usr/lib/lightdm/lightdm-set-defaults -l false

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

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

  • Confirm works on Ubuntu 12.04; should work for 11.10 and upwards (since those versions use LightDM as well).

To undo (restore Guest option):

sudo /usr/lib/lightdm/lightdm-set-defaults -l true

Update, for Ubuntu 14.04 LTS

Adapted from: Ubuntu Forums - lightdm config files location in 14.04

Just run this (once) at terminal:

sudo sh -c 'printf "[SeatDefaults]\nallow-guest=false\n" >/usr/share/lightdm/lightdm.conf.d/50-no-guest.conf'

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

  • Confirm works on Ubuntu 14.04 LTS beta 2

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

sudo rm /usr/share/lightdm/lightdm.conf.d/50-no-guest.conf
  • Confirm works on Ubuntu 14.04 LTS beta 2
share|improve this answer
1  
This didn't work for 13.10 (beta), 3 days ago. However, just tried again and succeeded. (!?) –  david6 Oct 3 '13 at 8:39
4  
This works for me on 13.10. –  wim Oct 22 '13 at 12:17
1  
Worked for me on 14.04 beta 2. BTW, SeatDefaults is not a spelling mistake, don't change it to SetDefaults. –  Nitish Apr 12 at 8:29

Type this in the terminal

gksu gedit /etc/lightdm/lightdm.conf

You will see the following:

[SeatDefaults]
greeter-session=unity-greeter
user-session=ubuntu

Add allow-guest=false to the end so your final result should look like:

[SeatDefaults]
greeter-session=unity-greeter
user-session=ubuntu
allow-guest=false

Save the document and quit the text editor.

Back in the Terminal, restart the display manager. (This will end the graphical login session, immediately quitting all programs running in it, so make sure your work--like any open documents--is saved first!)

sudo restart lightdm

With the graphical login session ended, you're returned to the login screen, where you'll notice that guest acount is disabled.

That's it--the guest account is no longer usable.

share|improve this answer

You can do that using Ubuntu Tweak.

To install it, use these commands:

sudo add-apt-repository ppa:tualatrix/ppa
sudo apt-get update
sudo apt-get install ubuntu-tweak

After installing, navigate to TweaksLogin Settings and switch off the "Guest account".

ubuntu tweak login settings

share|improve this answer
2  
Nice find, and by the way, Ubuntu Tweak will continue. –  mikewhatever Oct 21 '12 at 18:53
    
wow! great to know, @mikewhatever! (that was fast, guess he missed us a lot...) –  Eliran Malka Oct 21 '12 at 19:43

Just run

gksudo gedit /etc/lightdm/lightdm.conf

Add the following line

allow-guest=false

Then (this will immediately log you out, quitting any programs running in your graphical session, so save your work first):

sudo restart lightdm
share|improve this answer

13.04 and later

  1. Execute this command in a terminal

    sudo /usr/lib/lightdm/lightdm-set-defaults -l false
    
  2. Reboot your machine or restart lightdm with the following command
    (This will log you out immediately, save your data)

    sudo restart lightdm
    

Apparently, it works in 13.10 (can't test myself, but there's a comment here).

I'm using 13.04 and all this does it append allow-guest=false to /etc/lightdm/lightdm.conf, but it might be different in 13.10.

Originally by david6 from here: http://askubuntu.com/a/169105/176889

share|improve this answer
1  
Thanks. It created a lightdm.conf file, the same as with you, with allow-guest=false in it. –  11chubby11 Oct 21 '13 at 7:56
    
You should also do sudo restart lightdm for the changes to take effect. Without that, the guest session will still be listed on the login screen when you log out. –  Burhan Ali Oct 25 '13 at 13:34

Change allow-guest=trueto 'false' in /etc/lightdm/lightdm.conf

You can then either reboot or restart the service in the terminal: sudo restart lightdm

This is assuming you are using lightdm which is standard in 11.10.

share|improve this answer

Install ubuntu-tweak, get to the tweak tab, turn off the guest button and reboot. That's it!

One may find the terminal easier, but in case the need to turn on the guest account arises then one would have to visit this page again and see the instructions (or rather undo). That's the advantage of the GUI thing... one remembers it easily.

share|improve this answer

For Ubuntu 13.10, add

allow-guest=false

to the file /etc/lightdm/lightdm.conf.d/10-ubuntu.conf.

share|improve this answer

I'm in the same case, the file /etc/lightdm/lightdm.conf doesn't exist in UBUNTU 13.10.

I try to create the /etc/lightdm/lightdm.conf file with this line allow-guest=false, and CRASH, the system does not start properly, only console mode...

I try to edit the file /etc/lightdm/lightdm.conf.d/10-ubuntu.conf, and works properly.

Edit the file

sudo vim /etc/lightdm/lightdm.conf.d/10-ubuntu.conf

And enter the lines that you need

# to disable guest login
allow-guest=false
# to enable user login manually
greeter-show-manual-login=true

And the last one, restart your system

sudo reboot

I think that this works fine if you restart only the ligthgdm

sudo service lightdm restart
share|improve this answer

How to disable this option in the future

I just ran into the same problem on my new trusty/14.04 installation. Also to my surprise I couldn't find the lightdm.conf.d folder inside /etc/lightdm/ just users.conf.

Investigation

$ find / -iname *lightdm* 2>/dev/null | grep -v /mnt | grep -v /media | grep -v /home
[...]
/usr/share/lightdm/lightdm.conf.d
[...]

Aha, there you are. What's in there?

$ ls -1 /usr/share/lightdm/lightdm.conf.d/
50-greeter-wrapper.conf
50-guest-wrapper.conf
50-ubuntu.conf
50-unity-greeter.conf
50-xserver-command.conf

Okay, what's in there?

$ cat /usr/share/lightdm/lightdm.conf.d/*
[SeatDefaults]
greeter-wrapper=/usr/lib/lightdm/lightdm-greeter-session
[SeatDefaults]
guest-wrapper=/usr/lib/lightdm/lightdm-guest-session
[SeatDefaults]
user-session=ubuntu
[SeatDefaults]
greeter-session=unity-greeter
[SeatDefaults]
# Dump core
xserver-command=X -core

Conclusion

We find a bunch of configuration files similar to the INI format following the naming scheme of 50-${some-descriptive-name}.conf and configuring keys for the section [SeatDefaults].

We're not going to edit any of these files as these are meant to be managed by the package manager, but now we how we should add and manage our custom configuration bits to /etc.

Solution

Given the above, that lightdm is the display manager and the configuration files look like the above. The following solution should work:

  1. Create the missing directories:

    $ sudo mkdir -p /etc/lightdm/lightdm.conf.d
    
  2. Add a custom configuration file by running:

    $ sudo nano /etc/lightdm/lightdm.conf.d/50-disable-guest-session.conf
    

    and paste the following lines:

    [SeatDefaults]
    allow-guest=false
    

    Then save (Ctrl+O) and close (Ctrl+X).

  3. Now logout and switch to a virtual terminal (Ctrl+Alt+F1), then run:

    $ sudo service lightdm restart
    

    The guest session option should now be gone. If something is not working quite right you now know where the default configuration is stored and that you didn't change it.

Further reading

share|improve this answer

Open Terminal

gksudo gedit /etc/lightdm/lightdm.conf

Add the following line

allow-guest=false

Save and exit the file.

share|improve this answer
1  
Also there was no gksudo (or gksu) in my Ubuntu 13.10. –  11chubby11 Oct 21 '13 at 8:04

protected by Community Nov 29 '11 at 11:56

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.