Wednesday, September 24, 2014

[UBUNTU] : LightDM: How To Disable The User List Or Guest Session

LightDM: How To Disable The User List Or Guest Session
Quick tips for Ubuntu / LightDM users: if you want to hide the LightDM login screen user list and / or the Guest Session for security concerns, because there are too many users or whatever other reason, here's how to do it.

Ubuntu LightDM Unity Greeter
Default LightDM login screen (Unity Greeter) with user list and Guest Session enabled

1. To disable the LightDM login screen user list and / or Guest Session, firstly create the /etc/lightdm/lightdm.conf.d/ folder in case it doesn't exist, by using the following command:
sudo mkdir -p /etc/lightdm/lightdm.conf.d

2. Next, you need to create a file called 50-my-custom-config.conf under /etc/lightdm/lightdm.conf.d/ To open/create this file using Gedit (as root), use the following command:
gksu gedit /etc/lightdm/lightdm.conf.d/50-my-custom-config.conf

3.a. To hide the LightDM login screen user list (which means you'll have to manually enter your username), paste the following in this file (50-my-custom-config.conf):
[SeatDefaults]
greeter-hide-users=true
greeter-show-manual-login=true
Then save the file.

Here's how LightDM (with Unity Greeter) will look after this change:

Ubuntu LightDM disabled user list
=========================================
For UBUNTU 14.04 and above

The file to edit is now located in /usr/share/lightdm/lightdm.conf.d, and is called: 50-ubuntu.conf.

I just added the line:
 
greeter-show-manual-login=true

and on next reboot I was able to input any user name on the login screen.

OR

The solution is to create a file lightdm.conf inside /etc/lightdm/ and put the following contents in it:
 
[SeatDefaults]
greeter-show-manual-login=true

After a system reboot, I was able to login with other users.

==============================================



3.b. To disable the LightDM Guest Session, paste the following lines in the /etc/lightdm/lightdm.conf.d/50-my-custom-config.conf file:
[SeatDefaults]
allow-guest=false
Then save the file.

Here's a screenshot with the Guest Session disabled in LightDM (with Unity Greeter):

Ubuntu LightDM disabled guest session

3.c. Of course, you can combine the two. So if you want to hide the LightDM login screen user list and also disable the Guest Session, paste this in the /etc/lightdm/lightdm.conf.d/50-my-custom-config.conf file:
[SeatDefaults]
greeter-hide-users=true
greeter-show-manual-login=true
allow-guest=false
Then save the file.

Here's a screenshot with LightDM (Unity Greeter) in which the user list was hidden and the Guest Session was disabled:

Ubuntu LightDM disabled user list guest session

4. And finally, you need to restart LightDM (a logout is not enough). To do this, press ALT + F2 and copy/paste the following command:
gksu service lightdm restart
Then press ENTER.

You can also simply restart your system.

Why not use "sudo service lightdm restart" in a terminal? Well, for some reason LightDM can't be restarted from a terminal with 'sudo'. However, you can also restart LightDM by switching to a tty (to switch to tty1 press CTRL + ALT + F1; to switch back, use CTRL + ALT + F7) and then using the "sudo service lightdm restart" command.

How to revert the changes

To revert the changes made by following the instructions above, all you need to do is remove the /etc/lightdm/lightdm.conf.d/50-my-custom-config.conf file, by using the following command:
sudo rm /etc/lightdm/lightdm.conf.d/50-my-custom-config.conf

Then, restart LightDM as explained under step 4 or reboot your computer.

No comments: