Stop Ubuntu's Screen Lock from Killing Your Remote Desktop Sessions

Abstract: GNOME's screen lock suspends the remote desktop listener, so screen sharing fails until someone unlocks the machine locally. Disable the automatic lock or allow locked remote desktop to stay connected.

Created: 2026-11-10 by

If your Ubuntu screen-sharing connection drops after a period of inactivity and only recovers after you walk over to the machine and unlock it, the GNOME screen lock is the cause. The remote desktop service runs inside your user session and stops accepting connections while that session is locked. Disable the automatic lock, or explicitly allow remote access to a locked session, and the problem disappears.

Why the lock breaks screen sharing

Ubuntu's built-in Desktop Sharing is provided by gnome-remote-desktop, which runs inside your logged-in graphical session rather than as a system-wide service. When GNOME decides the session is idle — after the blank-screen delay, or when someone presses Super+L — it locks the session. In that locked state the listener on port 3389 (RDP) or 3390 (VNC) no longer accepts new connections, so your client times out or is refused. The machine is still powered on; only the session is locked. The moment someone unlocks it locally, the listener returns and remote access works again.

Confirm the lock is the culprit

Before changing settings, rule out networking and power issues:

  • When a connection fails, test the port from another machine, for example nc -zv <ip-address> 3389. If the port refuses while the screen is locked but responds right after a local unlock, the lock is responsible.
  • Check Settings → Power → Automatic Suspend. Actual suspension is a different problem requiring a "never suspend" setting or Wake-on-LAN.
  • Verify the machine is on the network at the moment of failure — a dropped Wi-Fi link mimics the same symptom.

Fix 1: turn off the automatic screen lock

The simplest solution keeps manual locking available but stops GNOME from locking on its own. On the target machine, open Settings → Screen Lock (under Privacy or Screen, depending on the release) and switch off Automatic Screen Lock. Then set Screen Blank to Never under Settings → Power so the idle timer never starts in the first place.

The same settings from a terminal:

gsettings set org.gnome.desktop.screensaver lock-enabled false
gsettings set org.gnome.desktop.session idle-delay 0

Run these as the user who owns the desktop session — not with sudo — because they are stored in that user's dconf database.

Fix 2: block the lock screen entirely (lockdown mode)

If you want locking to be impossible under any circumstance, including a manual Super+L or the Lock entry in the system menu, use GNOME's lockdown flag:

gsettings set org.gnome.desktop.lockdown disable-lock-screen true

To check the current state:

gsettings get org.gnome.desktop.lockdown disable-lock-screen

To restore normal locking later:

gsettings reset org.gnome.desktop.lockdown disable-lock-screen

Fix 3: keep the lock but allow remote connections

Prefer keeping the lock yet still connecting remotely? The GNOME Shell extension Allow Locked Remote Desktop keeps the remote desktop listener alive while the session is locked, letting you connect and type your password through the remote session itself. Install it from the GNOME Extensions website on the machine you connect to, enable it with the Extensions or Extension Manager app, then reconnect. For headless or hard-to-reach machines this offers the best balance of convenience and security.

A middle path: unlock over SSH

If you keep SSH access enabled, you can unlock a locked session without walking over:

loginctl list-sessions
loginctl unlock-session <ID>

Identify your graphical session in the first command's output, then unlock it by ID. It works, but it is clumsy as a routine workflow — treat it as an emergency escape hatch rather than your primary method.

Prevention and security notes

  • On machines in trusted rooms, disabling only the automatic lock is usually enough; manual locking stays available for when you step away.
  • An always-unlocked desktop is a genuine risk where others can reach the keyboard. Favor the extension (Fix 3) or SSH unlocking in shared or physically accessible spaces.
  • Protect the remote desktop itself with a strong password, and restrict port 3389/3390 with a firewall or VPN where possible.
  • If you apply the gsettings changes remotely over SSH, reconnect once afterward so the service picks them up cleanly.

Frequently Asked Questions

Why does the connection work fine until the machine sits idle?

The idle timeout triggers GNOME's screen lock, and the remote desktop listener lives inside the user session. When the session locks, the listener stops accepting new connections until someone unlocks the machine locally.

Does disabling the lock screen create a security risk?

It can. Anyone with physical access reaches an unlocked desktop, and remote access is guarded only by your sharing password. Disable the automatic lock on machines in trusted spaces; use the extension approach where physical access is a concern.

I disabled the lock but connections still fail. What now?

Check that the machine is not suspending, test the port directly, and confirm the settings were applied to the correct user — running gsettings with sudo writes to root's database instead of yours.

What is the difference between lockdown mode and the extension?

The lockdown flag removes the lock screen completely, so manual locking stops working too. The extension keeps locking intact but permits remote desktop connections to attach to a locked session so you can unlock it remotely.

Do I need to reboot after changing these settings?

Usually not. The changes take effect for the running session; if remote access still misbehaves, log out and back in once to restart gnome-remote-desktop cleanly.

Can I keep the display blanking for power savings?

Often yes — the blank itself is not the problem, the lock that follows is. Try disabling only the automatic lock first and leave Screen Blank enabled; if connections still fail, set blanking to Never as well.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More