This will be not only gedit , but in fact all programs that use the X11 protocol to talk to the graphics server. X11 uses the Xauth protocol to authenticate connecting clients. When you log in through some kind of display manager, the MIT-MAGIC-COOKIE-1 check cookie is created and written to your ~/.Xauthority file. This file is read by X11 clients, and the cookies it contains are used to authenticate connections.
The list of cookies in your ~/.Xauthority can be displayed using xauth list :
$ xauth list localhost:1012 MIT-MAGIC-COOKIE-1 bd988401cbf8xxxxxxxxxxxxxxxxxxxx some.host.example.com/unix:1012 MIT-MAGIC-COOKIE-1 bd988401cbf8xxxxxxxxxxxxxxxxxxxx
If you change the host name, the X11 client library will no longer be able to find a suitable cookie in the authentication database, and the X11 server will reject the failed connection (unless otherwise specified).
What you can do is add the appropriate cookie using xauth :
$ xauth add "$(hostname)/unix:0" MIT-MAGIC-COOKIE-1 bd988401cbf8xxxxxxxxxxxxxxxxxxxx
$(hostname) expands to the result of the hostname command, and unix:0 matches your DISPLAY environment variable set to :0.0 . If it is a different display number, for example. :ddd.0 , you must change the added host entry accordingly to "($hostname)/unix:ddd" . Also note that the value of the added cookie must match the value of the existing one.
If you do not have a terminal emulator at that time, and you cannot open it due to an authentication error, you can switch to the console (text mode), log in there and execute the command above.
Hristo iliev
source share