Page 4 of 9 FirstFirst ... 23456 ... LastLast
Results 31 to 40 of 88

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

  1. #31
    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 Toastermax
    these directions worked perfectly for me. thanks.

    is there anywhere i can get a breakdown of what that script does and how it does it?
    Sure.
    Code:
    for uri in $NAUTILUS_SCRIPT_SELECTED_URIS; do
    This is a simple for loop that goes through each of the URIS (file locations) specified in the variable $NAUTILUS_SCRIPT_SELECTED_URIS and performs the next part on each of them.
    Code:
    gnome-sudo "gnome-open $uri" &
    This is what does the prompt for your password and, if correct, opens the variable uri (which is each file in turn as per the for loop) according to its mime-type. The '&' puts the process "in the background" which means that each file is opened at the same time. Without '&', each file would have to wait for the previous one to close before it was opening. Think of it as a big field where everybody can stand at once (&) in contrast to a queue where only one person can be inside the field (no &).
    Code:
    done
    Just closes off the for loop.

    Every line starting with a '#' is a comment: this is code that will not be executed. The first line, '#!/bin/sh', is a little different. This is a special signal to the shell to execute the following with the 'sh' shell (usually bash). Some scripts might have '#!/bin/ksh' or even '#!/usr/bin/perl' (which is for perl scripts). For more information check out the Advanced Bash-Scripting Guide.
    Cut down on bored clutter: use the search tool.
    Have you answered a post today?
    New Ubuntu Hoary users might want to check out the Hoary After-Install Helper. Just some shameless self-promotion.

  2. #32
    Join Date
    Mar 2005
    Beans
    13

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

    Quote Originally Posted by Nis
    Sure.
    Code:
    for uri in $NAUTILUS_SCRIPT_SELECTED_URIS; do
    This is a simple for loop that goes through each of the URIS (file locations) specified in the variable $NAUTILUS_SCRIPT_SELECTED_URIS and performs the next part on each of them.
    Code:
    gnome-sudo "gnome-open $uri" &
    This is what does the prompt for your password and, if correct, opens the variable uri (which is each file in turn as per the for loop) according to its mime-type. The '&' puts the process "in the background" which means that each file is opened at the same time. Without '&', each file would have to wait for the previous one to close before it was opening. Think of it as a big field where everybody can stand at once (&) in contrast to a queue where only one person can be inside the field (no &).
    Code:
    done
    Just closes off the for loop.

    Every line starting with a '#' is a comment: this is code that will not be executed. The first line, '#!/bin/sh', is a little different. This is a special signal to the shell to execute the following with the 'sh' shell (usually bash). Some scripts might have '#!/bin/ksh' or even '#!/usr/bin/perl' (which is for perl scripts). For more information check out the Advanced Bash-Scripting Guide.
    still a bit fuzzy to me but a bir of reading should give me some better questions to ask. thanks for the explanation.

  3. #33
    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 segrewb
    I'm not going to pretend to be a programmer, but would the following work for kde?


    Code:
    #!/bin/sh
    ### openas-root:
    ###   konqueror script for opening the selected files as superuser (uid=0),
    ###   utilizing the appropriate applications.
    
    for uri in $KONQUEROR_SCRIPT_SELECTED_URIS; do
    	kde-sudo "kde-open $uri" &
    done
    
    ### end of file.
    Thanks in advance

    Segrewb
    Thanks for your sugestion, but this doesn't seem to work in kde ... First of all I dont think kde-sudo and kde-open exist (on my computer anyhow). I tried modifying your script to use gksudo and gnome-open (gnome-open seems to work in KDE as well) but I couldn't find anywhere to put the script where it would work on the right-click menu. Anyone else have any ideas?

  4. #34
    Join Date
    Mar 2005
    Beans
    6,040

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

    wow, i'm glad that this has been so useful to so many of you! rock on!
    Last edited by 23meg; April 13th, 2005 at 02:27 AM.
    Previously known as 23meg

  5. #35
    Join Date
    Nov 2004
    Location
    Malaysia
    Beans
    162

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


  6. #36
    Join Date
    Apr 2005
    Location
    icbm://51.5221#07.4528 (E
    Beans
    21
    Distro
    Ubuntu 7.04 Feisty Fawn

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

    connellr,

    Quote Originally Posted by connellr
    Thanks for your sugestion, but this doesn't seem to work in kde ... First of all I dont think kde-sudo and kde-open exist (on my computer anyhow). I tried modifying your script to use gksudo and gnome-open (gnome-open seems to work in KDE as well) but I couldn't find anywhere to put the script where it would work on the right-click menu. Anyone else have any ideas?
    this won't work at all. Konqueror doesn't set the variable and AFAIK has no Nautilus-compatible scripting interface.

    It might, however, be possible to do that for KDE, too, but this will involve digging deep into the Konqueror/DCOP API, which has various language bindings (including python, IIRC). If you are interested in hacking together something, you might want to have a look at this site -- good luck.

    Regards,
    Alexander

  7. #37
    Join Date
    Mar 2005
    Location
    Green
    Beans
    32

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

    Quote Originally Posted by alexp
    connellr,



    this won't work at all. Konqueror doesn't set the variable and AFAIK has no Nautilus-compatible scripting interface.

    It might, however, be possible to do that for KDE, too, but this will involve digging deep into the Konqueror/DCOP API, which has various language bindings (including python, IIRC). If you are interested in hacking together something, you might want to have a look at this site -- good luck.

    Regards,
    Alexander
    Thanks for the link to the kde site. Looks promising. I'll check into it.

    Thanks again,

    Segrewb

  8. #38
    Join Date
    Apr 2005
    Location
    U.S.A. Missouri
    Beans
    38

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

    I have been using these gems in KDE for years.


    Code:
    [Desktop Entry]
    ServiceTypes=application/x-executable,application/x-shellscript,application/x-python,application/x-perl
    Actions=runassu
    
    [Desktop Action runassu]
    Name=Run as Root
    Name[de]=Als root ausfhren
    Name[cs]=Spustit jako root
    Name[sk]=Spustiť ako root
    Name[hu]=Futtatás rootként
    Icon=kfm
    Exec=kdesu -c
    Code:
    [Desktop Entry]
    ServiceTypes=inode/directory,inode/directory-locked
    Actions=Openassu
    
    [Desktop Action Openassu]
    Name=Open as Root
    Name[de]=Als root �fnen
    Name[cs]=Otevřít jako root
    Name[sk]=Otvoriť ako root
    Name[hu]=Megnyitás rootként
    Icon=kfm
    Exec=kdesu "konqueror --profile filemanagement %U"

    Place the files here:
    /usr/share/apps/konqueror/servicemenus

    Now you will have run as root and open as root in your right click "action" menu.

  9. #39
    Join Date
    Jun 2005
    Location
    Coin, Spain
    Beans
    187

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

    crimsonking - hi I really need to have easier root access to modifying files etc as suggested in this thread. I am using KDE

    Could you explain a bit more about the two files you suggest creating?

    1. Do I just create these in a text editor?

    2. What do I call them?

    3. Do you have the english words for those in the files (!!!)

    Thanks for any help you can give.

  10. #40
    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

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