42

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?

1
  • 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/… May 1 '15 at 21:59
21

Try

xhost +local: 

before running it.

3
  • 2
    it did the trick. Thanks, I think it is the shortest answer! Jul 26 '19 at 16:19
  • 2
    $ xhost +local: xhost: unable to open display "desktop:0"
    – Mona Jalal
    Jan 23 at 3:10
  • 6
    What does the command do?
    – Moberg
    Apr 29 at 10:36
15

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.

1
  • 5
    This ignores the XAUTHORITY problem, which is what causes the actual error message in the subject line.
    – kiko
    Dec 6 '18 at 8:29
9

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

 export DISPLAY=:1.0
2
  • Worked for me! Been stuck with this error for a long time. Could you please explain what it means though? May 6 at 14:04
  • :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
    May 6 at 14:47
2

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.

1

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.

0

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/$
venkat@home-laptop:~/Downloads/$
venkat@home-laptop:~/Downloads/$ sudo -i
root@home-laptop:~#
root@home-laptop:~# xclock
Invalid MIT-MAGIC-COOKIE-1 keyError: Can't open display: :1
root@home-laptop:~#
root@home-laptop:~#
root@home-laptop:~# exit
logout
venkat@home-laptop:~/Downloads/$
venkat@home-laptop:~/Downloads/$ xclock

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

0

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.

0

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.

0

First add IP

xhost +inet:172.26.95.35

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

xhost

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.