LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Create a shortcut for a program that launches in a root terminal (https://www.linuxquestions.org/questions/linux-newbie-8/create-a-shortcut-for-a-program-that-launches-in-a-root-terminal-4175441902/)

brezer 12-17-2012 11:25 PM

Create a shortcut for a program that launches in a root terminal
 
I am trying to figure out how to make a short cut that will open the root terminal and start a program. Iam using gnome, i tried to make a short cut by right clicking the desktop, when i run it the terminal window flashs and i can see my program running but it flashs out it does not run.

I used this as an example

http://www.ceveni.com/2009/05/how-to...ux-debian.html

I am needing it to go to
/home/username/workspace/MMOCoreORB-Testing/bin and then ./core3 to start it up.

Was wondering if anyone had an idea how to do this or how i could make the short cut on the desktop that would open the root and i would like the terminal window to stay open also.

Thanks for any advice guys :)

shivaa 12-19-2012 08:12 AM

A shortcut can be created using soft link, for example:
Code:

ln -s </path/to/target_file> <link_name>

But I didn't understand root terminal? Do you mean a terminal launched by root i.e. root is logged in that terminal to invoke the programme? Although a shortcut can be created, but problem is that if you're logged in as a normal user, then it will ask you to enter root's password, when you'll launch that shortcut.

colucix 12-19-2012 08:42 AM

To launch a terminal as root in Gnome 2 you can try the beesu command. In order to keep it open after the execution of the command has terminated and to specify the command itself, you can create a new Profile. At first run the command
Code:

$ beesu gnome-terminal
from any terminal, write the root's password when prompted and in the newly open terminal go to Edit --> Profiles. Click New to add a Profile, choose a name and click Create. In the next window (Editing profile) go to the Title and Command tab and check "Run command as a login shell" and "Run a custom command instead of my shell". In the Custom command text box type:
Code:

bash -c "cd /home/username/workspace/MMOCoreORB-Testing/bin; ./core3
Finally in the When command exits drop-down menu select "Hold the terminal open".

Now you have to create a custom launcher on your desktop and in the Command box type:
Code:

beesu gnome-terminal --window-with-profile=ProfileName
where ProfileName is the name you chose before. Now, when you click the launcher you will be prompted for root password, a terminal will open and the command executed as root and it will stay on your desktop until you explicitly close it.

This procedure is valid on CentOS 6 with Gnome 2.28 installed. I cannot test on Fedora or Debian-like distributions, but maybe the method is slightly different. Hope this helps.


All times are GMT -5. The time now is 01:56 PM.