You are not logged in.

Dear visitor, welcome to KDE-Forum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

gabba

Beginner

  • "gabba" started this thread

Posts: 1

Location: Canada

  • Send private message

1

Monday, June 13th 2005, 9:14pm

Editing configuration files owned by root

This is a simple suggestion for KDE developers: right now, editing config files for which you don't have write permissions is a pain. You can open them in Kate from Konqueror, but they will be read-only; if you want to modify them you'll have to open a terminal window, cd to the file (useless extra effort, especially if it's deep into nested directories), and either edit it with sudo nano/vi, or kdesu gedit.

A practical and intelligent solution would be to add the following features:
- a button or menu entry in all kde text editors (and why not all kde programs that can edit something?) to "edit as root": click it, and you're prompted for the root password to edit the already open file with full permissions. If an app can't acquire root privileges once it's already started, then it just has to launch a "kdesu appname filename". Having the editable file in a new window will be better than nothing. The point is, often you don't know whether you need to modify a file until you have actually looked at it, so why linger in root mode before you actually need it?
- an edit (or edit as root) context menu option for any file for which you don't have write permission: right-click on the file, click edit, and you're prompted for the root password to edit the file in kate with full permissions. This should be configurable, so you can use whatever program instead of kedit/kate. You should also be able to define a different program than kate for each type of file: for example, use audacity to edit a sound file owned by root.
- a switch to root button in Konqueror that allows you to quickly get admin privileges whenever you're browsing your filesystem and you realize you need to change file permissions (for instance). Starting a second Konqueror window as root (or a root terminal) is impractical, because you have to cd again to the right location, which might be deep into nested directories, and so on.

anda_skoa

Professional

Posts: 1,273

Location: Graz, Austria

Occupation: Software Developer

  • Send private message

2

Monday, June 13th 2005, 9:35pm

RE: Editing configuration files owned by root

Quoted

Originally posted by gabba
- a switch to root button in Konqueror that allows you to quickly get admin privileges whenever you're browsing your filesystem and you realize you need to change file permissions (for instance). Starting a second Konqueror window as root (or a root terminal) is impractical, because you have to cd again to the right location, which might be deep into nested directories, and so on.


A process can't acquire higher privileges unless it is suid root, which would be a bad idea either.
So "editing as root" would always require starting a another application.

If you just need a console you can either use tools->open konsole or embedded console.
The first one will open in the directory you are currently viewing and the other one even follows the main view.
On both cases a simple
su
will change the shell session to root.

Edit as root in the context menu could be possible with a service menu which calls
kdesu kfmclient exec %u

Unfortunately this could execute the target if it is a script or bianry executable.
But it could be possible to restrict that action for the root account through Kiosk.

Edit: just found this http://www.kde-apps.org/content/show.php?content=11998

Cheers,
_
Qt/KDE Developer
Debian User