1. Overview

In Linux, guest sessions are used to give temporary and anonymous access to users. This feature allows users to log in to our system without providing a username or password. This brings about some security and privacy concerns. For instance, some users logged in as guests may try to manipulate files or install malware, which can compromise our system. So, as an administrator, the best way to avoid these risks is to disable the guest session feature.

In this tutorial, we’ll discuss disabling guest sessions in Linux. Specifically, we’ll focus on Ubuntu and other Debian-based distributions.

2. Disabling Guest Sessions

To disable guest sessions, we need to modify the LightDM configuration file, named lightdm.conf. This configuration file is located in the /etc/lightdm directory and allows system administrators to customize the login process and appearance of the login screen.

Now, let’s access the file:

$ sudo nano /etc/lightdm/lightdm.conf

Using the above command, we open the lightdm.conf file in the nano text editor with superuser (sudo) privileges. While in this file, we’ll locate the [Seat:*] section, which contains settings related to user sessions and the display manager’s behavior. This is where we’ll make adjustments to disable guest sessions.

Next, let’s disable guest sessions:

[Seat:*]
allow-guest=false

Here, we add the allow-guest=false setting in the [Seat:*] section. As a result, this setting disables guest sessions on our system. At this point, we need to save the changes by pressing Ctrl+o and then Enter. Once this is done, the next step is exiting the editor by pressing Ctrl+x.

Lastly, we need to restart LightDM to apply the changes:

$ sudo service lightdm restart

Above, we use the service command to restart the LightDM display manager. Alternatively, we can use the systemctl command:

$ sudo systemctl restart lightdm

Once LightDM has successfully restarted, guest sessions should now be disabled on our system.

3. Conclusion

In this article, we discussed how to disable guest sessions in Linux. In particular, we achieved this by making some changes to the LightDM configuration file using the nano text editor.

Disabling guest sessions in our system helps maintain its integrity and prevents unauthorized access.