If you use
sudo, you may have noticed that, with Fedora Core 5, you just can’t exec a graphical application as root (for example) if you haven’t actually logged in as root in your X environment (you never do that! Do you?).
You have probably encountered this type of message:
1 2 3 4 $ sudo kcalc Xlib: connection to ":0.0" refused by server Xlib: Invalid MIT-MAGIC-COOKIE-1 key kcalc: cannot connect to X server :0
To be able to launch a graphical application as root, the
XAUTHORITY environment variable must be copied to the shell launched by
1 $ sudo visudo
This will open the
_XKB_CHARSET, just add
XAUTHORITY. This should now look like:
1 2 3 4 5 6 Defaults env_keep = "COLORS DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR \ LS_COLORS MAIL PS1 PS2 QTDIR USERNAME \ LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC \ LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS \ _XKB_CHARSET XAUTHORITY"
Now, you can try:
1 $ sudo kcalc