How to enable X11forwarding over SSH after switching to other user using 'su -' from root?

Solution Unverified - Updated -

Issue

  • If root logs in remotely via SSH with X forwarding enabled (-X) and switches to other users using "su - <username>", then starting a X application as the switched user fails with the below error message.

    $ xclock
    X11 connection rejected because of wrong authentication.
    X connection to localhost:11.0 broken (explicit kill or server shutdown).
    
  • If a windows machine is used with (PuTTy + Xming), then the below error message will be displayed.

Environment

  • Red Hat Enterprise Linux

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.