Cannot run kate, gedit as root (using su/kdesu)

Hello,
I have fresh installation of openSuSE 11.1 with KDE4. I only installed nVidia driver what also updated kernel to 2.6.27. I wanted to make changes in some config files so fastes way for me was to open KDE console and do:

su
Password: ****
kate

But nothing happened. Console was blocked but no window of kate. When I pressed CTRL+C then I could continue in console. The same problem is with gedit.
But when I run kate/gedit from console as me (normal user) it works well. I also tried

su root kate
Password: ****

and I got error message Cannot execute /usr/bin/kate. I thank the problem can be with running KDE application from console, so I ran Konqueror as root from SuSE menu, right clicked on file I wanted to open and selected open with kate. But nothing happened. Then I tryied to use gedit, and I got same merror message like in concole(Cannot execute /usr/bin/kate).
Do you think the problem is because I do not have latest kate/gedit or latest KDE4?

If you run su from a terminal and then try to execute commands, you won’t be able as xhost permissions won’t allow the new connection.

alt+f2 -> kdesu kate or kdesu gedit

Chrysantine,

On my 11.0 box, switching to root in konsole by using either “su” or “su -” and then entering “kate /etc/fstab” works. Kate opens and gives me root priveleges to edit and save fstab. I just tried these two methods. Konsole tells me kbuildsycoca is running and the konsole window is blocked from further normal keyboard input until I exit from kate.

Of course, the “kdesu” method works to run kate as root and the “sudo” method fails from konsole. That’s what I would expect.

Did I not understand your reply?

Hi,
It can be the reason. I will try to test it tomorrow.
However, it doesnot explaing why I am not able to open file in kate from Konqueror what I ran under root.

It changed in 11.1 and thus no longer works.

You can go around this by using xhost +localhost.

kdesu kate or kdesu gedit is the way to go

eg;

kdesu kwrite /etc/fstab

In a terminal
enter password when requestd
@Chrysantine was spot on

Is there a solution to this in gnome? I’m having the same sort of problem, wanting to edit and save config files in gedit. su in the terminal window doesn’t allow me to save files in the X11 session, tho I’m sure it would let me edit and save them if I knew how to use gedit from the command line. I’m running 11.0 with gnome.

gnomesu gedit /etc/fstab

(/etc/fstab) is just an example location.

Chizelle wrote:
> Is there a solution to this in gnome?

try:

gnomesu gedit


decorated_warrior

Thanks, that’s easier than chmod 777, chmod 644 for each file that needs to be changed. ^-^

Hi all,
sorry I did not responded faster.
I tried to run:

kdesu kate /etc/fstab

It works well. However, when I run Dolphin or Konqueror as root and try to open any file in kate from them, it fails.
http://vlabra.ic.cz/screen-shots/cannot-run-kate-from-dolphin-as-root.png
Sorry,
KDEInit could not run '/usr/bin/kate’