phyver / GameShell

a game to learn (or teach) how to use standard commands in a Unix shell
GNU General Public License v3.0
2.12k stars 135 forks source link

Mission 18 : X11 connection rejected because of wrong authentication. #116

Closed shaavik closed 2 years ago

shaavik commented 2 years ago

I use putty with X11 forwarding.

I can launch xeyes from the terminal, but I have the following message on mission 18 when trying to launch xeyes :

[mission 18] $ xeyes
X11 connection rejected because of wrong authentication.
Error: Can't open display: localhost:10.0

It seems like there is a problem with xauth.

[gameshell@gameshell ~]$ xauth list
gameshell.localdomain/unix:10  MIT-MAGIC-COOKIE-1  c281b0f7f91a9f30c5f12cc95b33daa2
[gameshell@gameshell ~]$ ./gameshell-save.sh

  |                                            |
--+--------------------------------------------+--
  | Tapez la commande                          |
  | $ gsh help                                 |
  | pour obtenir la liste des commandes "gsh". |
--+--------------------------------------------+--
  |                                            |

~
[mission 18] $ xeyes
X11 connection rejected because of wrong authentication.
Error: Can't open display: localhost:10.0

~
[mission 18] $ xauth list
xauth:  file /home/gameshell/gameshell/World/.Xauthority does not exist

~
phyver commented 2 years ago

Well, that looks like a bug, but I've never played with xauth and the like. I wouldn't have expected GameShell to interact with this, but apparently, it does.

Does the same thing happen if you run gameshell.sh instead of gameshell-save.sh?

phyver commented 2 years ago

The problem probably comes from the fact that the .Xauthority file isn't found in its default location because $HOME is redefined by GameShell. Can you tell me if running

    $ export XAUTHORITY=$HOME/.Xauthority
    $ ./gameshell.sh
    [mission 1] $ xeyes

works?

I could export the XAUTHORITY variable if it exists, but I am reluctant to define it if it doesn't exist because it might break the mission on system that have a different default value.

phyver commented 2 years ago

It should be fixed by 4a719123