15/11/2007

HowTo run KDE applications as root

If you get "foo: cannot connect to X server" when you try running KDE applications as su from the shell - don't worry, apparently this is a security feature, and not a bug. I remember being able to do so under openSUSE 10.2, but anyway... it can be fixed the following ways:

You can either use

> kdesu foo &

Or, before you become root, enter the following

> xhost +
> su
# foo &

If you now get the error "bash: foo: command not found", then you need to add /opt/kde3/bin to root's $PATH. First, check whether the file /root/.bashrc already exists. If not, create it. Then add the following line

export PATH=$PATH:/opt/kde3/bin

Then log out and back in - you need to log in after you modify the file for bash to find your new $PATH.

# exit
# su

and check whether the new directory is now in your $PATH

# echo $PATH

No comments: