Skip to content
Follow
Ubuntu Linux

How to Disable Logout on Ubuntu Desktop

Richard
Written by
Richard
Updated 4 min read
How to Install Google Chrome on Ubuntu Linux
How to Install Google Chrome on Ubuntu Linux
Before you start
  • 11 steps
  • Needs administrator rights
  • Includes a restart or sign-out

Disabling the log out button on Ubuntu Desktop removes the “Log Out” option from the system menu, so nobody ends the session by accident. This helps on shared computers running Ubuntu 22.04 LTS or later with the GNOME desktop, which is the default desktop on those releases.

Advertisement

The button is controlled by a hidden GNOME setting, and you can change it from the Terminal or from a graphical editor. The change usually shows up right away. If the Log Out entry is still in the menu, restart the computer or log out and back in, then check again.

⚡ Quick Answer

Open the Terminal with Ctrl+Alt+T and run gsettings set org.gnome.desktop.lockdown disable-log-out true. The Log Out option disappears from the system menu on Ubuntu 22.04 LTS or later with GNOME, for your user account only, usually without a restart. To bring it back, run gsettings reset org.gnome.desktop.lockdown disable-log-out.

Advertisement

Prevent users from logging out of Ubuntu

The quickest way to hide the button is a single command in the Terminal. Once it is set, other people using the machine can’t end your active session from the system menu by accident.

Ubuntu Linux activities overview Terminal search
Ubuntu Linux activities overview Terminal search
  1. Press Ctrl+Alt+T to open the Terminal. You can also search for Terminal in the Activities overview. A window with a command prompt should appear.
  2. Type or paste the command shown in the next block and press Enter. You don’t need sudo, because the setting applies only to your own user account.
  3. If the command prints nothing, it worked. This is normal for this kind of command.
📝Good to KnowBecause the setting only affects your account, other user accounts on the same computer keep their Log Out button unless you repeat the command for them.
Advertisement

gsettings set org.gnome.desktop.lockdown disable-log-out true

To get the Log Out button back, run the restore command from the block below in the Terminal. It returns the setting to its default value, and the Log Out option becomes visible again in the system menu on Ubuntu Desktop.

  1. Open the Terminal with Ctrl+Alt+T.
  2. Run the command shown below.
  3. Open the system menu at the top right and check that Log Out is listed again. If it isn’t, restart the computer and check once more.

gsettings reset org.gnome.desktop.lockdown disable-log-out

Advertisement

Disable or enable the Log out command using the Dconf Editor

💡TipIf you would rather not use the command line, you can use Dconf Editor, a graphical configuration tool for GNOME.

It shows the same settings as a browsable tree with switches and text fields, so you can turn them on and off without typing commands.

Dconf Editor is not installed by default on Ubuntu. The next section covers the install.

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.

This method needs a one-time installation step first. Open the Terminal and run the command in the block below. It updates the package list and then installs the software, so it needs an internet connection and your password, since it uses administrator rights. Nothing shows as you type the password, which is normal.

Advertisement

sudo apt install dconf-editor

Installing from the package repositories remains the most reliable way to get the tool. When the command finishes and the prompt returns, open Dconf Editor from the app list.

  1. Open Activities and click Show Applications, or just start typing Dconf Editor.
  2. Click the Dconf Editor icon. A warning screen may appear first; click I’ll be careful to continue.
ubuntu linux decon editor install
Ubuntu Linux dconf editor install

Next, find the disable-log-out setting, which controls whether the system lets users end their sessions. Use the search icon or the path bar at the top of the window and go to the path shown below:

org -> gnome -> desktop -> lockdown

Advertisement
  1. Find the disable-log-out entry in the list.
  2. If the value looks greyed out, turn off Use default value first. Dconf Editor won't let you edit a value while that switch is on.
  3. Click the toggle switch next to disable-log-out to hide the option. The switch should now show as on.

To undo it, switch the toggle off again, or turn Use default value back on.

Ubuntu Linux disable log out command
Ubuntu Linux disables the logout of the command.

The change should take effect straight away, with no restart. Open the system menu at the top right of the screen and look for the Log Out entry. If it is gone, the setting worked. If it is still there, restart the computer and check again.

Ubuntu Linux with log out enabled
Ubuntu Linux without enabled

Have a question about this guide?

Answered by AI from this guide. Good questions may be added to this page — please don't include personal details.

Did this guide fix your problem?

Richard

About the Author

Richard

Tech Writer, IT Professional

Richard is a writer at Geek Rewind who turns complex IT tasks into clear, step-by-step guides. He draws on years of hands-on experience in system administration and enterprise IT operations, focusing on Windows, Linux and WordPress: the problems people actually run into, and the fixes that work. His server and WordPress guides come from systems he runs himself. Richard builds and maintains the platform behind Geek Rewind, from its Ubuntu servers and Nginx configuration to its custom WordPress plugins. Many new tutorials start with readers' questions, and he's always glad to answer them in the comments.

Advertisement

No comments yet — be the first to share your thoughts!

Leave a Comment

Your email address will not be published. Required fields are marked *