Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: HOWTO: open a file in Nautilus with gedit as root

  1. #1
    arnieboy Guest

    HOWTO: open a file in Nautilus with gedit as root

    we often need to edit files as root in a text editor. Now we can do this with a right click in Nautilus (no big deal about opening in terminal but what the heck!)

    Code:
    gedit ~/.gnome2/nautilus-scripts/gedit-root
    Copy the following lines into the file and save it and close it.
    Edited
    Code:
    #created by Arnav Ghosh (United States)
    foo=`gksudo -u root -k -m "enter your password for gedit root access" /bin/echo "Do you have root access?"`
    sudo gedit $NAUTILUS_SCRIPT_SELECTED_URIS
    Then make it executable with
    Code:
    chmod +x ~/.gnome2/nautilus-scripts/gedit-root
    thats it you are all set. Now right click on any file in nautilus and under "scripts" u will find "gedit-root"
    click and enjoy!
    U can even select multiple files and open them in gedit as root in tabbed windows just by right clicking and using this script. The possibilities are endless.
    Last edited by arnieboy; July 12th, 2005 at 03:20 PM.

  2. #2
    manicka Guest

    Re: HOWTO: open a file in Nautilus with gedit as root

    Quote Originally Posted by arnieboy

    Code:
    gedit ~/.gnome2/nautilus-scripts/Open\ in\ gedit\ as\ root
    when I issue this command 3 different gedit files open

    'open in', 'gedit' and 'as root'

    Edit: Forget this, something went wrong with my copy/paste into the terminal. all is well now
    Last edited by manicka; July 9th, 2005 at 03:51 AM.

  3. #3
    arnieboy Guest

    Re: HOWTO: open a file in Nautilus with gedit as root

    cool. enjoy

  4. #4
    manicka Guest

    Re: HOWTO: open a file in Nautilus with gedit as root

    Quote Originally Posted by arnieboy
    cool. enjoy
    installed okay and context menu appears.

    Nothing happens though when chosen... sigh

  5. #5
    arnieboy Guest

    Re: HOWTO: open a file in Nautilus with gedit as root

    Quote Originally Posted by manicka
    installed okay and context menu appears.

    Nothing happens though when chosen... sigh
    I have edited the script. try it now. U will get a warning abt "this is not a regular file.. blah blah". just ignore it. if it can be opened by gedit, it will be opened.

  6. #6
    manicka Guest

    Re: HOWTO: open a file in Nautilus with gedit as root

    not on my ubuntu box at the moment. I'll give it a go later

    thanks

  7. #7
    manicka Guest

    Re: HOWTO: open a file in Nautilus with gedit as root

    this works okay but I wasn't happy about the error messages

    did a bit of searching and this script works for me without any errors

    Code:
    for uri in $NAUTILUS_SCRIPT_SELECTED_URIS; do
    	gnome-sudo "gnome-open $uri" &
    done
    This will open any folder or file with it's associated program as root.

    If it's a text based file it opens in gedit
    Last edited by manicka; July 9th, 2005 at 08:58 AM.

  8. #8
    arnieboy Guest

    Re: HOWTO: open a file in Nautilus with gedit as root

    i know abt that script but it wont open a .desktop file for editing in gedit.. for example.. my script helps open any text based file.. even executables.
    Last edited by arnieboy; July 9th, 2005 at 09:21 AM.

  9. #9
    manicka Guest

    Re: HOWTO: open a file in Nautilus with gedit as root

    Thanks for the explanation.

    I think I'll keep both and use as necessary

  10. #10
    Join Date
    Dec 2004
    Location
    Providence, RI
    Beans
    32
    Distro
    Ubuntu

    Re: HOWTO: open a file in Nautilus with gedit as root

    Quote Originally Posted by manicka
    this works okay but I wasn't happy about the error messages

    did a bit of searching and this script works for me without any errors

    Code:
    for uri in $NAUTILUS_SCRIPT_SELECTED_URIS; do
    	gnome-sudo "gnome-open $uri" &
    done
    This will open any folder or file with it's associated program as root.

    If it's a text based file it opens in gedit

    that seems a bit dangerous doesn't it? opening anything as root, it harks back to easily installable windows virsus.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •