Problem to access X desktop from a root terminal
Last modified on July 24, 2026 • 1 min read • 117 wordsIt never happened to me under Red Hat 9, but when I am working in KDE as a normal user and try to execute emacs from a terminal, in which I am su, I occasionally get the following error message:jeltsch@mcblpc2:~ suPassword:mcblpc2:/home/jeltsch emacs test.txtXlib: connection to “:0.0” refused by serverXlib: Invalid XDM-AUTHORIZATION-1 key (failed key comparison)emacs: Cannot connect to X server :0.0.Check the DISPLAY environment variable or use -d’.Also use the xhost’ program to verify that it is set to permit connections from your machine.
jeltsch@mcblpc2:~> suPassword:mcblpc2:/home/jeltsch emacs test.txtXlib: connection to ":0.0" refused by serverXlib: Invalid XDM-AUTHORIZATION-1 key (failed key comparison)emacs: Cannot connect to X server :0.0.Check the DISPLAY environment variable or use -d’.Also use the xhost’ program to verify that it is set to permit connections from your machine. In order to allow root to access X, you need to execute the following command: mcblpc2:/home/jeltsch export XAUTHORITY=/home/jeltsch/.Xauthoritymcblpc2:/home/jeltsch emacs test.txtOf course, I can use emacs without its GUI and just type:emacs -nw test.txt