Page 1 of 3 123 LastLast
Results 1 to 10 of 88

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

Hybrid View

  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
    Location
    Brisbane, Australia
    Beans
    32
    Distro
    Ubuntu 6.06

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

    Quote Originally Posted by Nis
    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
    sorry... real newbie here... can you dumb this down a bit for me? ie. let me know what to type into the console. I managed to browse to ~/.gnome2/nautilus-scrips/ but when I did an ls and it showed the folder as empty so I wasn't sure where to go from there. The back slashes has me confused too, can you explain them to me...
    oh and if you have time... where exactly is ~/.gnome2 ? I tried to find it in nautilus but couldn't. i'm thinking it's hidden or something. TIA.

  8. #8
    Join Date
    Apr 2005
    Location
    Iowa - US
    Beans
    29
    Distro
    Ubuntu 6.06

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

    Quote Originally Posted by Nis
    As and you shall receive. Put the following into ~/.gnome2/nautilus-scripts/Open\ as\ root
    <...snip...>
    Is there a way that you can do the same for Kubuntu (KDE)? If anyone knows it'd be appriciated.

  9. #9
    Join Date
    Dec 2004
    Location
    Fountain Hills, Arizona
    Beans
    134
    Distro
    Ubuntu 8.04 Hardy Heron

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

    My thanks. I get tired of having to constantly either use sudo or a root terminal just to do a little configuration. I've had as many as 4 root terminals open at a time, 3 of them locked into operating some program (such as gedit). THIS should solve the problem. Thanks

  10. #10
    Join Date
    Nov 2010
    Beans
    19

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

    Quote Originally Posted by Nis View Post
    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
    Noob to Linux - several years late.

    "~/.gnome2/nautilus-scripts" is an empty directory.
    What/where are you wanting with the "/Open\ as\ root" ??

    The chmod I get. The gksudo line I get.

    I'm not seeing how to connect the dots.

    Thanks

Page 1 of 3 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
  •