Announcement

Collapse
No announcement yet.

Editing Privileged Files from Desktop

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Editing Privileged Files from Desktop

    The standard for all varieties of Ubuntu seems to be that sudo should be used in preference to running as root. Many of the administrative tools provide an interface that appears to wrap the tool invocation with the execution of sudo. However, the most fundamental administrative tool seems to be missing. How are you supposed to do simple text editing?

    On Ubuntu I found that opening a console window and entering the following command works nicely -

    sudo gedit /etc/fstab

    This led me to the idea that the same thing might work on Kubuntu. In this case the following -

    sudo kate /etc/fstab

    In fact it does seem to work. However, I'm not sure what to make of the following lines that appear on the console -

    ajax@Tester:~$ sudo kate /etc/fstab
    [sudo] password for ajax:
    Error: "/var/tmp/kdecache-ajax" is owned by uid 1000 instead of uid 0.
    Error: "/tmp/kde-ajax" is owned by uid 1000 instead of uid 0.
    Error: "/tmp/ksocket-ajax" is owned by uid 1000 instead of uid 0.

    Can anyone explain what's going on here?

    #2
    Re: Editing Privileged Files from Desktop

    If you press <Alt> + <F2> and type: kdesudo kate /etc/fstab Kate will open the file.

    kdesudo should be used for applications, i believe.

    Comment


      #3
      Re: Editing Privileged Files from Desktop

      Yes, kdesudo is the prefix for graphical/kde apps, like kate. It can be run in the Alt-F2 window.

      sudo is the prefix for command line commands and apps, like nano.

      Comment


        #4
        Re: Editing Privileged Files from Desktop

        Sigh - so you still have to use CLI...

        Why not make it soooooo much simpler? Right-click in Dolphin, Open as root (kdesudo)... THAT would be an elegant GUI way of doing it.

        Can this be done by writing a plugin somehow?
        Regards,
        Oceanwatcher
        Blog: http://www.wisnaes.com/
        Pictures: http://www.oceanwatcher.com/
        Software tips (in Norwegian): http://www.datahverdag.com/

        Comment


          #5
          Re: Editing Privileged Files from Desktop

          Just for you Oceanwatcher

          ***************************************
          [Desktop Entry]
          Type=Service
          ServiceTypes=KonqPopupMenu/Plugin
          MimeType=all/allfiles;
          Actions=rootKate;
          Encoding=UTF-8
          ExcludeServiceTypes=application/x-iso,kdedevice/*,inode/directory

          [Desktop Action rootKate]
          Name=Edit as Root
          Exec=kdesudo kate %f
          Icon=attach
          *************************************************

          put the part between asterisks in a file called RootKate.desktop and put it in
          /usr/share/kde4/services/ServiceMenus

          Close dolphin and reopen it. Right click on any file and look under Actions for Edit as Root.
          Enjoy

          Comment


            #6
            Re: Editing Privileged Files from Desktop

            For a little more accurate mimetypes you could use this one.
            ************************************************** *******************
            [Desktop Entry]
            Type=Service
            ServiceTypes=KonqPopupMenu/Plugin
            MimeType=text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-patch;text/x-adasrc;text/x-chdr;text/x-csrc;text/css;application/x-desktop;text/x-patch;text/x-fortran;text/html;text/x-java;text/x-tex;text/x-makefile;text/x-objcsrc;text/x-pascal;application/x-perl;application/x-perl;application/x-php;text/vnd.wap.wml;text/x-python;application/x-ruby;text/sgml;application/xml;model/vrml;
            Actions=rootKate;
            Encoding=UTF-8
            ExcludeServiceTypes=application/x-iso,kdedevice/*,inode/directory

            [Desktop Action rootKate]
            Name=Edit as Root
            Exec=kdesudo kate %f
            Icon=attach
            ************************************************** ***************

            Comment


              #7
              Re: Editing Privileged Files from Desktop

              That, my friend, was pure genius! And waaay beyond anything I would ever be able to figure out without a few years of only studying Linux!

              Thank you. You just made my life editing textfiles a lot easier!
              Regards,
              Oceanwatcher
              Blog: http://www.wisnaes.com/
              Pictures: http://www.oceanwatcher.com/
              Software tips (in Norwegian): http://www.datahverdag.com/

              Comment


                #8
                Re: Editing Privileged Files from Desktop

                Glad I could help. Actually someone called g. in this forum has been mentioning this and piquing my interest, so you can thank him. Also the KDE people who developed the framework that makes it work.

                Comment


                  #9
                  Re: Editing Privileged Files from Desktop

                  Originally posted by Oceanwatcher
                  Sigh - so you still have to use CLI...

                  Why not make it soooooo much simpler? Right-click in Dolphin, Open as root (kdesudo)... THAT would be an elegant GUI way of doing it.

                  Can this be done by writing a plugin somehow?
                  There are also a few servicemenus available from kde-apps/kde-look that allow that (and doing other things as root from the right-click menu).

                  Yes, shameless advertising, as one of them was written by me :P.
                  http://www.kde-apps.org/content/show...?content=48411
                  Rog has kindly packaged it in his ppa for easy installation (on intrepid and jaunty):
                  https://launchpad.net/~samrog131/+archive/ppa

                  Comment

                  Working...
                  X