How can I use X11 forwarding for sudo users that are connected via ssh ?

Solution Verified - Updated -


  • export DISPLAY => Error: Can't open display:
  • X11 forwarding works fine for the user that connects to a remote system via ssh, but it fails after the user context has been changed with sudo


  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 9

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