Run as root context menu

David M. Carney david at n1zhe.org
Sun Oct 10 17:28:44 UTC 2004


OK. Try this.

Create a short script (make sure it is executable) in your
~/.gnome2/nautilus-scripts folder. Name it "Run as su".

Note that if you want to run a command as root, you must assign a root
password. See the Ubuntu FAQ at
http://www.ubuntulinux.org/support/documentation/faq/helpcenterfaq.2004-09-15.5722653677

The script is:

#!/bin/bash
#
for I in `echo $*`
do
   /usr/bin/gksu $I
   done
done
exit0

If you wish to NOT activate the root account and continue to use sudo
instead, then substitute "gksudo" for the "gksu" in the above script.

To use the script, use Nautilus to find an executable file that you want
to run. Right-click on it. Move you pointer down to "Scripts". Then
select the "Run as su" entry. 

You will get a dialog box asking for a password. If you use gksu, then
you will have to supply the root password. If you use gksudo, then you
will have to use your password.

The program will then execute with the appropriate privileges.

David

-- 
Registered Linux User #297958


On Sun, 2004-10-10 at 13:06 -0400, David M. Carney wrote:
> Hmmm.
> 
> I read this and thought that would be nice. I thought a nice little
> script might do. It might not be "pretty", but it might work.
> 
> So I wrote a quick little script and dropped it in the
> ~/.gnome2/nautilus-scripts folder.
> 
> Then I went in search of a gui executable to test my little script. I
> found one and tried to open it using my script and quickly discovered
> that either Nautilus no longer has an option to use user defined scripts
> or I forgot how to make it use them.
> 
> David
> 
> -- 
> Registered Linux User #297958
> 
> 
> On Sun, 2004-10-10 at 11:23 -0500, Ethan King wrote:
> > Since root is disabled by default, It would be nice if when I right
> > clicked on a program launcher one of the options was to run that
> > program as root.  This could be very useful sometimes for doing file
> > management in Nautalis or editing a file in gEdit.
> > 
> > Just a thought.
> > -Ethan
> > 
> 
> 





More information about the ubuntu-users mailing list