#1 Naive question: why can't I edit root-owned files?

OK, I understand about changing to Super User, but my system doesn’t behave as I expect.

Here’s the example: I’m trying to edit smb.conf

I can issue the command <kwrite /etc/samba/smb.conf>, get presented with a nice GUI based editor with that file open, make the changes and then click ‘save’. I’m warned that save might not work, take the option to proceed and indeed save fails. No surprise: I don’t have permission to write that file.

I change to SU and issue the same command again. Now nothing happens at the command line - no GUI based edit screen is opened. The only change is in the title bar for that terminal window. It changes from <user:> bash to <user:> kwrite. I seem to be in the editor, but not in GUI mode and none of the existing file contents are displayed. The only way to exit this dialog is with <Ctrl><Shift><Q> - and this also closes my terminal session. So I can’t edit the file that way.

If I issues the command KDESU /etc/samba/smb.conf as a user, then a similar behaviour results.

The only way I have found to edit this root-owned file is to use the KDE application launcher–>Applications–>System–>File Manager–>File Manager - Super User Mode/KDE3

Surely there must be a more direct way than this?

I forgot to say that I’m using KDE 4.1, but if I don’t use the KDE3 version File Manager, then I get this error message when attempting to open the file from the file manager (Dolphin) browser:

KDEInit could not launch /usr/bin/kwrite

Is this indicative of some sort of configuration problem?

kdesu kwrite /etc/samba/smb.conf

should work. Just prefix any command you want to execute as root with kdesu, that’s the rule.

This problem does exist with kde4.1. Most users got round it the way you have done via file-manager - superuser mode. Some just upgraded to kde4.3,which also solved this issue


Agreed. This the best method.

I’ve just baffled my head with this been in all kinds of places so often we see xhost blah… tried that then decided not to try it and tested. Well blow me down with a feather xclock works fine. So next started looking at kdmrc nothing I could see would cause this behaviour finally stumbled across it…

su -
kwrite /the/file

Need to use su proper to get roots env thats all.

OK, got it. That’s simple enough. Thanks.

Easy wihout the console Alt+F2 then enter kdesu kwrite /pathTo/file

Excellent! How elegantly simple.

A lot like me really, apart from the fact that I’m not all that elegant.