PDA

View Full Version : Root and KDE



Markus
02-28-2005, 09:54 AM
If you try to use X-apps as root you probably get:
root@mrk-fujibox:~# kedit
kedit: cannot connect to X server :0.0
There are several fixes. I usually make a .profile in roots home dir with the following content:
root@mrk-fujibox:~# cat .profile
export DISPLAY=:0.0
You can check the variable with:
markus@mrk-fujibox:~$ echo $DISPLAY
:0.0
To create the file you need to use a console editor like mcedit:
markus@mrk-fujibox:~$ su
Password:
root@mrk-fujibox:/home/markus# cd
root@mrk-fujibox:~# mcedit .profile
-use F2 to save and F10 to quit, tips are at the bottom of the screen.

If you try to login to KDE as root it won't work. You should never login to KDE as root as it's a security risk.
To do root stuff you can use:
- sudo
- su
- sux
- kdesu kedit (or some other app)
If you really, really need to login to KDE as root you can search this forum for the answer, it's here but I'm not posting it in this thread for the simple reason that it shoudn't be used.

tom p
02-28-2005, 06:54 PM
If you try to use X-apps as root you probably get:
root@mrk-fujibox:~# kedit
kedit: cannot connect to X server :0.0
There are several fixes. I usually make a .profile in roots home dir with the following content:
root@mrk-fujibox:~# cat .profile
export DISPLAY=:0.0
That's usually not enough - it won't work e.g. if you issue "su -" in a console to open a root shell. You'd have to also enter "xhost +localhost" before you do the "su -" to get permission to connect to the local X server; even better: open the root shell by "kdesu xterm" (or any other X console program); this will transfer the "magic X11 cookie" needed to connect to the X server (that is also the command that you execute, if you open a root shell from the Knoppix menu).

Thomas

Markus
02-28-2005, 07:24 PM
You're probably right, forgot the following file I have:
markus@mrk-fujibox:~$ cat .kde/Autostart/kufbootstuff.sh
#!/bin/sh
xhost local:
numlockx on

Markus
03-11-2005, 10:09 PM
As someone pointed out the file permissions also play a role in this:
root@mrk-fujibox:~# ll ~/.profile
-rw------- 1 root root 31 Mar 6 13:54 /root/.profile

markus@mrk-fujibox:~$ ll ~/.kde/Autostart/kufbootstuff.sh
-rwx------ 1 markus markus 284 Dec 16 19:52 /home/markus/.kde/Autostart/kufbootstuff.sh

The filename kufbootstuff.sh can be changed to anything.sh
You can set the executable bit with: chmod u+x ~/.kde/Autostart/filename.sh

You also need to logout and login again for the file under .kde to get loaded, or just do: xhost local: