Quick and Dirty GUI Text Configuration Editor

Aaron and I have been kicking around the idea of an elevated privilege GUI flat text editor for normal users to easily modify text configuration files. Using Vi, emacs (yuck), or nano from the command line is too much to ask for newbie on something as basic as configuring yum.

Well, turns out the answer may already exist. YDL already uses console helper to elevate the privileges of all the current system-config-* graphical utilities, and it looks like with a little work we take regular ol’ gedit Text Editor and make it into the configuration editor we’re looking for:

This is just a testing example so I don’t forget what I did:

1. First, copy the regular gedit to our new gedit-root

bash# cp /usr/bin/gedit /usr/sbin/gedit-root

2. Create link for console helper

bash# ln -s /usr/bin/consolehelper /usr/bin/gedit-root

3. Based on the system-config-services file, create a PAM entry

bash# vi /etc/pam.d/gedit-root

#%PAM-1.0
auth include config-util
account include config-util
session include config-util

4. Create console security console.app entry

bash# vi /etc/security/console.app/gedit-root

USER=root
PROGRAM=/usr/sbin/gedit-root
SESSION=true

5. Create YDL Menu entry based on existing gedit entry. I just copied the existing file into a new version and edited the following lines:

bash# cp /usr/share/applications/gnome-gedit.desktop /usr/share/applications/gedit-root.desktop

bash# vi /usr/share/applications/gedit-root.desktop

Name=Configuration Text Editor
Comment=Edit Configuration Files
Exec=gedit-root

That should place the icon under Menu -> Application -> Accessories -> Configuration Text Editor. With a little digging, probably could put it under system tools like it belongs.

Anyhow, now when you are a regular user and click it, you will be prompted to enter the root password. From there you can edit yum.conf, yaboot.conf, smbconf or whatever in a simple GUI environment.

You can even drag the file from nautilus and drop it on the editor and it will open automagically to edit.