Thursday, 25 October 2012

How-to: Disable Guest Account on Ubuntu 12.10

Guest account login in LightDM, Ubuntu 12.10
A guest account allows anyone to use the computer without login credentials - no username or default password.

 Ubuntu has a guest account enabled by default right through to the current release, 12.10. It has always struck me as a fundamentally insecure thing.

Anyone I let on my machine as 'guest' usually has me standing at their shoulder or gets their own user account. Otherwise the guest account is available right there at the login menu screen, and despite it's reduced level of permissions, I think of it as an open book for crackers and browser-based exploits.


You would think there would be an option in, say, System Settings to turn the blasted thing off, but no. This is apparently one more system control that Canonical thinks we don't need or can't be trusted to use. So much for freedom of choice in Linux.

OK, then, we'll do this the unnecessarily hard way...

To disable the guest account from their Ubuntu 12.04 (Precise Pangolin) or later, we need to remove it from the account list in LightDM - this is the greeter screen you see on start-up.

LightDM is an X display manager for login interfaces., which replaced the old GDM (Gnome Display Manager, which required a stack of Gnome libraries, hence it was pensioned off).


LightDM isn't exactly transparent or designed for user configuration. Go figure. Instead, you'll have to edit the lightdm.conf configuration file.

Run the following command in the terminal to open /etc/lightdm/lightdm.conf file in the gedit on your Ubuntu system.

$ gksudo gedit /etc/lightdm/lightdm.conf

Mine contains only:
[SeatDefaults]
user-session=ubuntu
greeter-session=unity-greeter

Add the following line to the end of the lightdm.conf file.

allow-guest=false

Save and close out the opened lightdm.conf file on your Ubuntu system.

You can either wait until next re-boot or run the following command in the terminal to restart LightDM.

$ sudo restart lightdm

but note this command will close all graphical programs running on your machine as the X windows system restarts in its entirety. RC

7 comments:

  1. Very useful tip, thank you!

    ReplyDelete
  2. nice this works perfectly and is simple and straight forward enough for the less command line initiated.

    ReplyDelete
  3. Does this really disable the guest account or just hide it? If someone were to try to access my machine via its public IP could they log into the shell with the guest account?

    ReplyDelete
  4. THANK YOU!!!!

    ReplyDelete

At least try to be nice, it won't kill you...