Page 7 of 9 FirstFirst ... 56789 LastLast
Results 61 to 70 of 88

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

  1. #61
    Join Date
    Dec 2005
    Location
    Western Australia
    Beans
    11,480
    Distro
    Ubuntu 12.04 Precise Pangolin

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

    Quote Originally Posted by bsawler View Post

    When I type
    Code:
    gksudo "gnome-open %u"
    in the terminal, it just drops down a line and refreshes the bottom tool bar. Am I missing something.
    Yes, you are.

    The command isn't intended for putting into the terminal - it's intended to create a drag and drop launcher to open files as root.

    Create a launcher on your desktop, and set the command as the above. Now drag and drop the xorg.conf file to it. You will be prompted for your password, and then Gedit should open with the file.
    I try to treat the cause, not the symptom. I avoid the terminal in instructions, unless it's easier or necessary. My instructions will work within the Ubuntu system, instead of breaking or subverting it. Those are the three guarantees to the helpee.

  2. #62
    Join Date
    Jun 2007
    Beans
    42

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

    Sorry I missed the launcher part.

    I created a launcher by right clicking on the desktop > added the above code... and all works great.

    Thanks,
    Bradley

  3. #63
    Join Date
    Jul 2007
    Beans
    11

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

    Hi

    I am a new user to Linux/Ubuntu. I am having problems running certain programs, such as Firestarter, AVG Updates, ClamAV Updates. I keep getting a message that I don't have permission, that I need to run them as the "root". Will this work to resolve this issue with these programs? Also, I have already run this in "terminal", it asked me for a password, then disappeared. I'm gathering from reading the posts on here that this was supposed to create an icon on my desktop, it didn't do that. Nothing at all happened after I entered the password. I am the ONLY user on this pc. I entered the script as shown in the first entry, did I do something wrong?

    Thanks in advance
    buddah3618

  4. #64
    Join Date
    May 2007
    Beans
    3

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

    Thank you for this

  5. #65
    Join Date
    May 2007
    Beans
    3

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

    Quote Originally Posted by buddah3618 View Post
    Hi

    I am a new user to Linux/Ubuntu. I am having problems running certain programs, such as Firestarter, AVG Updates, ClamAV Updates. I keep getting a message that I don't have permission, that I need to run them as the "root". Will this work to resolve this issue with these programs? Also, I have already run this in "terminal", it asked me for a password, then disappeared. I'm gathering from reading the posts on here that this was supposed to create an icon on my desktop, it didn't do that. Nothing at all happened after I entered the password. I am the ONLY user on this pc. I entered the script as shown in the first entry, did I do something wrong?

    Thanks in advance
    buddah3618

    you right click on your desktop then click "create a launcher" then put gksudo "gnome-open %u" in the command slot, give it a name and if u want a special icon. I'm thinking you were just putting the command in the terminal?
    Last edited by scifipirate; August 2nd, 2007 at 03:43 PM.

  6. #66
    Join Date
    Feb 2008
    Beans
    34

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

    Hello forum members,
    I have Ubuntu 7.10 installed on my computer,but when I tried the drag and drop sudo launcher command with the create launcher dialog box, I got the following error message:"Could not save launcher;the name of the launcher is not set."

    What does this error message mean, and how do I correct it???

  7. #67
    Join Date
    Oct 2007
    Beans
    6

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

    This is a great tip. I have used it to solve this little problem http://ubuntuforums.org/showthread.php?t=827310. Thank you very much op!

  8. #68
    Join Date
    Feb 2007
    Location
    New York
    Beans
    894
    Distro
    Ubuntu 9.10 Karmic Koala

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

    Would xdg-open be better than gnome-open?
    "Please remember to do things the Ubuntu way. There is always more than one solution to a problem, choose the one you think will be the easiest for the user. ... Try to think as a green user and choose the simplest solution." — Code of Conduct

  9. #69
    Join Date
    Mar 2009
    Beans
    7

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

    Quote Originally Posted by kanem View Post
    Sweet script. But I also like being able to open as root the folder I'm already in, and not have to go up one folder, then select the folder and run the script. I already had a script that did this (and only this; didn't open files as root). So I combined the two. Here's the result:
    Code:
    #!/bin/sh
    ### openas-root:
    ###   nautilus script for opening the selected files as superuser (uid=0),
    ###   utilizing the appropriate applications.
    
    if [ -n "$1" ]; then
    for uri in $NAUTILUS_SCRIPT_SELECTED_URIS; do
            gnome-sudo "gnome-open $uri" &
    done
    else
    gnome-sudo "nautilus --no-desktop $NAUTILUS_SCRIPT_CURRENT_URI"
    fi
    ### end of file.
    If you have a file (or files) selected it opens it (them) with root. If no file is selected it opens the working directory with Nautilus as root.
    Sorry im new to this so i ask stupid questions:
    Where i put this code?
    Some existing file or create new one? What directory?

  10. #70
    Join Date
    Jul 2005
    Beans
    366

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

    Quote Originally Posted by TurpoNieminen View Post
    Sorry im new to this so i ask stupid questions:
    Where i put this code?
    Some existing file or create new one? What directory?
    You have to create a new file in ~/.gnome2/nautilus-scripts, give it any name and put the above as content. Then set the "Allow executing file as program" using nautilus file properties.

    Then the name you chose should show up in right-click context menu when you select a file in nautilus, under "Scripts".

    However, the script above does not work in Jaunty / 9.04. I don't know why. If all you need is to edit the file as root, then this simpler script does work in 9.04:


    Code:
    #! /bin/sh
    
    # Usage:
    # 1) From Nautilus (assumes nautilus-scripts is setup): right-click on a single file, select the script link
    #
    
    gksudo gedit "$1"
    I'd rather use the more generic solution where gnome chooses the appropriate application based on the file type instead of hardcoding to gedit. I anyone can fix the original URI + gnome-open -based script that would be awesome. For some reason in all recent ubuntu versions the generic script stopped working.

Page 7 of 9 FirstFirst ... 56789 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
  •