Software⏱️ 4 min read📅 2026-06-11

How to Fix: X11 Forwarding: X11 connection rejected because of wrong authentication. Error: cannot open display: localhost:10.0

Learn how to fix: X11 Forwarding: X11 connection rejected because of wrong authentication. Error: cannot open display: localhost:10.0.

Quick Answer: Try checking your system settings or restarting.

The X11 connection rejected because of wrong authentication error affects users who are trying to forward X11 connections from a remote server to their local machine. This issue is frustrating as it prevents users from accessing graphical applications on the remote server. In this guide, we will walk you through the troubleshooting steps to resolve this issue.

The primary goal of this guide is to help you identify and fix the root cause of the X11 connection rejected error, enabling you to access graphical applications on a remote server.

🛑 Root Causes of the Error

  • The first main reason why this error happens is due to an incorrect value for the 'XAuthLocation' option in the SSH client configuration. When X11 forwarding is enabled, the SSH client needs to know where to find the authentication file. If the value is not set correctly, it can lead to a wrong authentication error.
  • Another possible reason could be that the XAUTHORITY environment variable on the local machine does not match the expected location. This might happen if there are multiple display servers running on the system or if the user has changed their desktop environment.

🚀 How to Resolve This Issue

Use the 'XAuthLocation' option to specify the correct path for the authentication file

  1. Step 1: Step 1: Open the SSH client configuration file using a text editor. The location of this file may vary depending on your operating system, but it is usually located in ~/.ssh/config.
  2. Step 2: Step 2: Add or modify the 'XAuthLocation' option to point to the correct path for the authentication file. For example, if the authentication file is stored in /home/user/.Xauthority, you would add the following line: XAuthLocation /home/user/.Xauthority
  3. Step 3: Step 3: Save and close the configuration file. Then, try running the command again to see if the issue is resolved.
  4. Step 4: method_2_name

Alternative Advanced Fix

  1. Step 1: Step 1: Check the value of the $XAUTHORITY environment variable on your local machine. If it does not match the expected location, you may need to adjust it.
  2. Step 2: Step 2: Verify that there are no multiple display servers running on your system or if the user has changed their desktop environment. You can check this by running the xhost command and looking for any authorized clients. If necessary, you can remove any unauthorized clients or adjust the xhost settings.
  3. Step 3: method_2_name

✨ Wrapping Up

In conclusion, resolving the X11 connection rejected error due to wrong authentication requires identifying and addressing the root cause of the issue. By following these steps, you should be able to resolve the error and access graphical applications on a remote server.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions