LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Is there a command to open a root terminal and execute a function? (https://www.linuxquestions.org/questions/linux-general-1/is-there-a-command-to-open-a-root-terminal-and-execute-a-function-4175443310/)

cravengemetzel 12-28-2012 05:51 PM

Is there a command to open a root terminal and execute a function?
 
I am trying to set up my Openbox menu exactly as I want it to be, but I ran into a problem: some of my pentesting programs require me to be root in order to run, so I can't just add "Eterm -e programname" in the menu.

What I need is something that will cause a gksu (or the like) interface to come up, asking me to authorize myself as root, and then run "Eterm -e programname" as root. Is this possible? What would my menu entry look like? Thanks.

*EDIT*

I realized that to open a root terminal, all I need to do is "gksu Eterm" but "gksu Eterm -e programname" does nothing at all.

gradinaruvasile 12-29-2012 08:25 AM

Maybe

Code:

gksu "eterm -e programname"
If the program name doesnt include quotes.

cravengemetzel 12-29-2012 10:53 AM

Quote:

Originally Posted by gradinaruvasile (Post 4858987)
Maybe

Code:

gksu "eterm -e programname"
If the program name doesnt include quotes.

Adding the quotes like you suggested got me a little further than nothing happening at all; now the password prompt comes up, then the terminal also comes up but only flashes for a fraction of a second before exiting.

The main reason that I want these programs in my menu is so that I remember that I have them installed; many of them need me to feed them an argument else they just print out the help screen (which is okay for the purpose of remembering my installed programs). Those that don't print out a help screen, don't exit immediately. Those that do print a help screen, do exit immediately; openbox interprets the return of the command prompt as the program being terminated. Which it is, I would just rather the terminal window stayed open with the help screen, but I don't think there is a solution to this specific problem.

As the post below me says, scripting is probably my best option. Thanks for your help, I'll mark this thread as solved.

kareempharmacist 12-30-2012 04:10 AM

you need to dive inside bash scripting.. a simple script will solve your problem.
posting your problem in the programming forum will concentrate on the issue..I trying to read about scripting to solve your problem.


All times are GMT -5. The time now is 07:24 AM.