How to Disable the Ubuntu Linux Guest Session to Improve Security

The Security Risks of the Ubuntu Guest Session

Many desktop environments in Ubuntu Linux historically included a “Guest Session” feature on the login screen. This feature allows anyone with physical access to the computer to log in without a password and use a temporary, restricted workspace. While the guest user cannot access your personal files or change system settings, they can still access the internet, run software, and potentially use your machine’s network connection for malicious activity. For personal laptops and secure office workstations, leaving the guest session enabled presents an unnecessary security risk.

Disabling the Guest Session via LightDM

If your Ubuntu installation uses the LightDM display manager (common in Xubuntu, Ubuntu MATE, and older Ubuntu releases), you can permanently disable the guest login option by editing a configuration file in the terminal.

1. Open the terminal by pressing Ctrl + Alt + T.

2. You need to create a custom configuration file for LightDM. Type the following command and press Enter:

sudo nano /etc/lightdm/lightdm.conf.d/50-no-guest.conf

3. You will be prompted to enter your administrator password.

4. In the empty text editor that appears, carefully paste the following two lines:

[Seat:*]
allow-guest=false

5. Save the file by pressing Ctrl + O, press Enter to confirm the file name, and then exit the editor by pressing Ctrl + X.

Applying the Changes

To see the effect of this configuration change, you must restart the display manager. The easiest way to do this without disrupting system services is simply to restart your computer. When your machine reboots and returns to the login screen, the “Guest Session” option will be completely removed, ensuring that only users with authorised accounts and passwords can access the system.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.