running X programs as root

From thelinuxwiki
Revision as of 16:16, 20 September 2013 by Nighthawk (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.