It 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:~> su
Password:
mcblpc2:/home/jeltsch emacs test.txt
Xlib: connection to ":0.0" refused by server
Xlib: 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/.Xauthority
mcblpc2:/home/jeltsch emacs test.txt
Of course, I can use emacs without its GUI and just type:
emacs -nw test.txt