I am attempting to run an application (ParaView) in client-server mode with its graphics rendering being done on the remote (server) end. I am using SSH as my means of connecting to the server, but do not wish to use X-forwarding since it slows down the rendering process.

However, every time I try to open the application on the server's display, I get an error to this effect:

Invalid MIT-MAGIC-COOKIE-1 keyError: cannot open display ':0'

I have conducted extensive research into this matter and have already tried the following suggested procedure to no avail:

  1. Used "xauth list" to get the MIT-MAGIC-COOKIE-1 value for my local host's display.
  2. Logged into the remote host via ssh.
  3. Used "export DISPLAY=:0" on the remote host.
  4. On the remote host, used "xauth add" to overwrite the cookie value for the remote host's display with that of the local host's.

I'm convinced that this is the correct procedure, but that I'm just not transferring the right cookies to the right displays.

Again, I would like to be able to use ssh to effect the opening of applications on the remote computer's display. Ideally, I would like the entire process to be done via xauth rather than xhost, and once again, I have no need to use X-forwarding. What might I be missing or doing wrong?

  • 2
    Is there an X server running on the server's console? I don't understand where you want the program's output to be displayed. Your procedure is clearly wrong since you're getting the local host's cookie but you don't display on the local host. If there is an X server running on the remote machine and that's where you want the program to be displayed, see unix.stackexchange.com/questions/10121/… Commented May 1, 2015 at 21:59

12 Answers 12



xhost +local: 

before running it.

  • 2
    it did the trick. Thanks, I think it is the shortest answer! Commented Jul 26, 2019 at 16:19
  • 3
    $ xhost +local: xhost: unable to open display "desktop:0"
    – Mona Jalal
    Commented Jan 23, 2021 at 3:10
  • 26
    What does the command do?
    – Moberg
    Commented Apr 29, 2021 at 10:36
  • 2
    @Moberg: It disables authentication control. It allows any user to open graphical windows on your display. So it's not something you want to do all the time! But when you know you want to run some graphical app as a different user, it's what you need to do.
    – AlexC
    Commented Mar 2, 2022 at 15:52
  • 7
    $ DISPLAY=:0 xhost +local: gives Invalid MIT-MAGIC-COOKIE-1 key
    – aaa
    Commented Jun 16, 2022 at 14:22

This one worked for me. So I'm leaving this answer here.

 export DISPLAY=:1.0
  • Worked for me! Been stuck with this error for a long time. Could you please explain what it means though? Commented May 6, 2021 at 14:04
  • 5
    :1.0 is actually an abreviation and means "display 1 at localhost". The format of the display variable is [host]:<display>[.screen]. host refers to a network host name, and if absent means to connect to the local machine via a unix domain socket. Each host can have multiple displays, and each display can have multiple screens. Screens aren't used much anymore, with xinerama and now xrandr combining multiple screens into a single logical screen. Source: unix.stackexchange.com/a/16816
    – PSN
    Commented May 6, 2021 at 14:47
  • Thank you, you just helped solve a problem that has befuddled us (non-IT Mechanical Engineers) for a while. Commented Jul 14, 2023 at 14:03

The value you're using for DISPLAY is incorrect: if you don't want to use SSH X forwarding, DISPLAY must indicate the IP address of your X server (the desktop you want to display programs on). On the remote, run

export DISPLAY=desktop:0

replacing desktop with your local hostname or IP address. You may also need to change your X server's configuration to allow remote IP connections.

  • 6
    This ignores the XAUTHORITY problem, which is what causes the actual error message in the subject line.
    – kiko
    Commented Dec 6, 2018 at 8:29

The Invalid MIT-MAGIC-COOKIE-1 key part must be a separate (non-)error. I get it in the normal working case of starting any graphical program (even gitk).

Somebody just forgot to end it with a newline, so pretend it's a separate line.


For me the error was :

Invalid MIT-MAGIC-COOKIE-1 keyxcb_connection_has_error() returned true
Invalid MIT-MAGIC-COOKIE-1 keyERROR: Unable to create GUI. Exiting

I played with .Xauthority but it did nothing but hide the "MIT cookie" part, not the xcb_connection error. In the end it worked just by using @PSN answer (export DISPLAY=:1.0).

fwiw i'm on debian 9.


What I do:

On the host I am working at:

xhost +<remotehost>  #name or ip of remote host

On the remote host

in /etc/ssh/ssh_config:

X11Forward Yes  # add line 

in /etc/ssh/sshd_config

X11DisplayOffset 10   # set display to 10 for ssh forwarding`

finally in the shell:

export DISPLAY=localhost:10.0 

This allows for the encrypted connection to allow your local X server to manage graphics for the remote apps you invoke, while not opening it up to anyone except that remote machine, and still be 100% encrypted both ways. Of course you must restart the ssh server after changing the config files.

It also allows perhaps local users of the remote machine to go ahead and use the local XWindows without interference or jam up from remote users. Apps launch in their own windows but respond to local key settings.

  • Can just do xhost + to disable authentication altogether (but block TCP ports 6000-6063).
    – rustyx
    Commented Sep 25, 2023 at 14:30

old question, but still happening, here on a completely new installed Opensuse Leap 15.3

in my case I had an empty /etc/hostname file and did fill it with

hostnamectl set-hostname mySysName

to eliminate the "Invalid MIT-MAGIC-COOKIE-1 key" message (doing this with YaST seems more complicated - not tried)


This could be one of the reasons you could get the following error:

Invalid MIT-MAGIC-COOKIE-1 keyError: Can't open display: :1

Make sure you are running any GUI process from the same user where vncserver process is owned by.

For example:

venkat@home-laptop:~/Downloads/$ ps -eaf | grep vnc
venkat    3504     1  0 Apr06 ?        00:09:52 /usr/bin/Xvnc :1 -auth /run/user/1000/gdm/Xauthority -desktop home-laptop:1 (venkat) -fp /usr/share/fonts/X11//misc,/usr/share/fonts/X11//Type1 -geometry 1024x768 -pn -rfbauth /home/venkat/.vnc/passwd -rfbport 5901 -rfbwait 30000
venkat   10595  8391  0 02:33 pts/5    00:00:00 grep --color=auto vnc
venkat@home-laptop:~/Downloads/$ sudo -i
root@home-laptop:~# xclock
Invalid MIT-MAGIC-COOKIE-1 keyError: Can't open display: :1
root@home-laptop:~# exit
venkat@home-laptop:~/Downloads/$ xclock

So run both the vnc server & gui process as same user as possible from local ssh terminal.


I have this setup where I have ubuntu running in virtual box running on windows.

I run VcXsrv on the windows and start stuff from inside the Virtbox.

It was working well, and then my xterms died and I couldnt start it again and was getting this error.

My workaround was that I had to restart VcXsrv on windows but this time in Administrators mode, which I dont remember having to do before.

When I did that, it started working well again and I dont get this error anymore.

I guess this points to a permissions error but I havent figured out what.


First add IP

xhost +inet:

Run xhost without args to generate/commit the access control lists



If you met:

xhost: unable to open display "desktop:0"

and you use VNC,

please check user consistent.

if you VNC login is root, then command should be root.

  • 2
    According to the question, it would seem that DISPLAY=:0, so they're not even trying to have the application render on the display server (i.e. the user's client) Commented Nov 12, 2023 at 18:56

I had the same error while connecting from Ubuntu-23 client to Ubuntu-22 server. After I messed up my client with experiments with the .Xauthority file, I couldn't even start 'xclock' or 'xterm' locally.

I found a nice article telling me to look for my X session with ps aux | grep X and I found the following.

xxxx 2691 0.2 1.3 769144 104276 ? Sl 12:04 0:05 /usr/bin/Xwayland :0 -rootless -noreset -accessx -core -auth /run/user/1000/.mutter-Xwaylandauth.LHM7K2 -listenfd 4 -listenfd 5 -displayfd 6 -initfd 7 -byteswappedclients

I copied the file "/run/user/1000/.mutter-Xwaylandauth.LHM7K2" to my "~/.Xauthority" file and everything worked.

I assume that some things have changed with the Xwayland-Server.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .