How to run an X application via X11 forwarding over ssh or putty with X deport enabled ?

Solution Verified - Updated -

Issue

  • How to run an X application via X11 forwarding over ssh or putty with Xming when using sudo ? The following error is received
    # sudo <X_application>
    X11 connection rejected because of wrong authentication.
    The application lost its connection to the display localhost:11.0;
    most likely the X server was shut down or you killed/destroyed the application.
  • How to run an X application via X11 forwarding over ssh or putty with X deport enabled ?
  • When putty is used with Xming to run the application, below error message will be displayed.
    [display@gss-xen~]$ sudo virt-manager
    Xlib: connection to "localhost:11.0" refused by server
    Xlib: PuTTY X11 proxy: MIT-MAGIC-COOKIE-1 data did not match
    Xlib: connection to "localhost:11.0" refused by server
    Xlib: PuTTY X11 proxy: MIT-MAGIC-COOKIE-1 data did not match
    Traceback (most recent call last):
    File "/usr/share/virt-manager/virt-manager.py", line 376, in ?
    _show_startup_error(str(run_e), "".join[traceback.format_exc())]
    File "/usr/share/virt-manager/virt-manager.py", line 52, in _show_startup_error
    import gtk
    File "/usr/lib64/python2.4/site-packages/gtk-2.0/gtk/_init_.py", line 76 in ?
    _init |)
    File "/usr/lib64/python2.4/site-packages/gtk-2.0/gtk/_init_.py", line 64 in ?
    _init |)
    _gtk.init_check()
    RuntimeError: could not open display
    [display@gss-xen~]$ 
  • Cannot connect to X server localhost:11.0

  • Unable to open virt-manager getting error. When logged in as root it is working fine, when doing as sudoer getting below error:

# virt-manager
MobaXterm X11 proxy: Authorisation not recognised
Unable to initialize GTK: could not open display

Environment

  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 7

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