running X programs as root

From thelinuxwiki
Jump to: navigation, search

Problem

Attempts to run X programs as root or with sudo fails. Errors may include references to magic cookies or cannot connect to display.


Solution

add lines to /etc/profile

XAUTHORITY=/home/<user_name>/.Xauthority
export XAUTHORITY

where the <user_name> = the user your logged into your windows manager or X with.