[Discuss] Launch Shortcut as Sudo
Tom Metro
tmetro+blu at gmail.com
Tue Mar 12 16:12:35 EDT 2013
Chris O'Connell wrote:
> I put an icon to launch the script on the desktop, but I'm having two
> odd problems:
> I need to ensure the script runs as the super user.
Try gksudo:
gksu - GTK+ frontend for su and sudo
gksudo [-u <user>] [options] <command>
gksu is a frontend to su and gksudo is a frontend to sudo. Their
primary purpose is to run graphical commands that need root without
the need to run an X terminal emulator and using su directly.
However, in this case, it sounds like you might want to monitor your
script output in a terminal, in which case just incorporating sudo into
your script is appropriate. (A sudo rule or using SetUID would permit
the script to run without password prompting, if that's desired.)
> when I double click the icon the script I'm asked if I want to "Run in
> Terminal" or just run. Either one I pick the script never appears on the
> screen.
You can launch a terminal emulator while passing it a command to
execute. The specifics vary by emulator.
gnome-terminal -- is a terminal emulation application.
gnome-terminal [-e, --command=STRING] [-x, --execute ] ...
[...]
-e, --command=STRING
Execute the argument to this option inside the terminal.
-x, --execute
Execute the remainder of the command line inside the terminal.
So:
gnome-terminal -x /path/to/mysecript
is one way to do it.
-Tom
--
Tom Metro
Venture Logic, Newton, MA, USA
"Enterprise solutions through open source."
Professional Profile: http://tmetro.venturelogic.com/
More information about the Discuss
mailing list