Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss] Launch Shortcut as Sudo



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/



BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org