Page 1 of 9 123 ... LastLast
Results 1 to 10 of 88

Thread: HOWTO: Easily open any file as root via drag & drop

  1. #1
    Join Date
    Mar 2005
    Beans
    6,040

    Lightbulb HOWTO: Easily open any file as root via drag & drop

    Create a launcher with the following command:

    Code:
    gksudo "gnome-open %u"
    When you drag and drop any file on this launcher (it's useful to put it on the desktop or on a panel), it will be opened as root with its own associated application. This is helpful especially when you're editing config files owned by root, since they will be opened as read only by default with gedit, etc.
    Previously known as 23meg

  2. #2
    Join Date
    Feb 2005
    Beans
    Hidden!

    Re: HOWTO: Easily open any file as root via drag & drop

    Very nice trick 23meg! very nice.
    Sylvia: Look at what you've done to him!
    Christof: I have given Truman the chance to lead a normal life. The world, the place you live in, is the sick place.

  3. #3
    Join Date
    Nov 2004
    Location
    Kuala Lumpur, Malaysia
    Beans
    885
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: HOWTO: Easily open any file as root via drag & drop

    So simple yet so easy and usefull. Wonder why no one has thought of it earlier. Should definitely be added to UbuntuGuide.org

  4. #4
    Join Date
    Oct 2004
    Location
    Dallas, TX
    Beans
    112

    Re: HOWTO: Easily open any file as root via drag & drop

    Should be a trivial matter to work this up as a nautilus script, so it appears as an option in your right-click menu.

    Call me silly, but an icon on my desktop that opens things as root just makes me nervous.
    --dare2dreamer

  5. #5
    Join Date
    Oct 2004
    Location
    Somewhere in Virginia
    Beans
    174

    Re: HOWTO: Easily open any file as root via drag & drop

    Quote Originally Posted by dare2dreamer
    Should be a trivial matter to work this up as a nautilus script, so it appears as an option in your right-click menu.

    Call me silly, but an icon on my desktop that opens things as root just makes me nervous.
    As and you shall receive. Put the following into ~/.gnome2/nautilus-scripts/Open\ as\ root
    Code:
    #!/bin/sh
    gksudo "gnome-open  $NAUTILUS_SCRIPT_SELECTED_URIS"
    Then make it executable with
    Code:
    chmod +x ~/.gnome2/nautilus-scripts/Open\ as\ root

  6. #6
    Join Date
    Oct 2004
    Location
    The Netherlands
    Beans
    162
    Distro
    Ubuntu Breezy 5.10

    Re: HOWTO: Easily open any file as root via drag & drop

    Dude this is great! Nice job!

  7. #7
    Join Date
    Mar 2005
    Beans
    6,040

    Re: HOWTO: Easily open any file as root via drag & drop

    yes that's better, thanks Nis. and thanks all for the kind words
    Previously known as 23meg

  8. #8
    Join Date
    Oct 2004
    Location
    Dallas, TX
    Beans
    112

    Re: HOWTO: Easily open any file as root via drag & drop

    I love it when someone else does the work for me.

    You might do a little error checking on the file names to make sure it doesn't hang up on filenames with spaces.

    Either way, lovely hack.
    --dare2dreamer

  9. #9
    Join Date
    Oct 2004
    Location
    Somewhere in Virginia
    Beans
    174

    Re: HOWTO: Easily open any file as root via drag & drop

    Quote Originally Posted by dare2dreamer
    I love it when someone else does the work for me.

    You might do a little error checking on the file names to make sure it doesn't hang up on filenames with spaces.

    Either way, lovely hack.
    Already done. Passing the file as a URI (instead of just a filename) is already taken care of by Nautilus and gnome-open. I believe the spaces are replaced with "%20".

  10. #10
    Join Date
    Mar 2005
    Location
    Brisbane, Australia
    Beans
    104
    Distro
    Xubuntu 12.04 Precise Pangolin

    Re: HOWTO: Easily open any file as root via drag & drop

    This is excellent

    Thanks 23meg and Nils. Life just got even easier 8)

    maqi
    A Gentleman is one who can play the bagpipes, yet chooses not to.

Page 1 of 9 123 ... 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
  •