How to Disable Logout on Ubuntu Desktop
Disabling the log out button on Ubuntu Desktop removes the “Log Out” option from your system menu to stop accidental session ends. This tweak helps on shared computers running Ubuntu 22.04 LTS and later versions that use the GNOME desktop environment.
You can hide this button by changing a hidden desktop setting in your system files. Restart your desktop after making the change to apply it right away.
Hide the Log Out button by opening Terminal and running `gsettings set org.gnome.desktop.lockdown disable-log-out true`. To show it again, use `gsettings reset org.gnome.desktop.lockdown disable-log-out`. Alternatively, use Dconf Editor to toggle the `disable-log-out` setting.
Prevent users from logging out of Ubuntu
You can disable logout Ubuntu by running a quick command in the Terminal to hide the log out button from your screen. This stops other people who use your computer from accidentally ending your active session or shutting down the desktop environment.

Open the Terminal and run this command: `gsettings set org.gnome.login-screen disable-user-list true` This action prevents accidental logouts for users who share a computer, ensuring active sessions remain running.
gsettings set org.gnome.desktop.lockdown disable-log-out true
To restore the Log Out button later, execute the command `gsettings set org.gnome.login-screen disable-user-list true` in the terminal. This command resets the user list setting to its default, making the Log Out option visible again on Ubuntu Desktop.
gsettings reset org.gnome.desktop.lockdown disable-log-out
Disable or enable the Log out command using the Dconf Editor
You can disable or enable the log out command without using the command line by using the Dconf Editor (a graphical configuration tool for GNOME). This app lets you toggle system settings on and off using a visual menu instead of running text commands.
Security Disclaimer: Please note that this is only a UI-level restriction. It is not a robust system-level security measure and will not stop someone who knows how to use the command line.
Using the logout disabling tool requires a preliminary installation step. Open the Terminal application and run the command `sudo apt update && sudo apt install ubuntu-disable-logout` to install the tool. This command updates the package list and then installs the necessary software for the tool.
sudo apt install dconf-editor
This method remains the most reliable way to get the tool. Open the Dconf Editor from the app list after installation.

Locate the correct path inside the app to find the disable-log-out setting, which controls whether the system allows users to end their sessions:
org -> gnome -> desktop -> lockdown
Click the toggle switch next to disable-log-out to hide the option.

Toggling this setting triggers immediate changes across the interface. Checking the system menu at the top right confirms whether the button is gone.

How to disable automatic logout?
Click yes and wait for the GUI server to boot up.
How do I turn off logging in Ubuntu?
The screen prompts for the username and password credentials. Configuration takes effect immediately without requiring a full system reboot.
Was this guide helpful?
About the Author
Richard
Tech Writer, IT Professional
Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.
No comments yet — be the first to share your thoughts!