Enable ssh X11forwarding after switching to other user using 'su -' or sudo from root user?

Solution Verified - 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(All Releases)

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content