Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I run eclipse always as root in ubuntu 12.04?

Tags:

eclipse

root

When I want to run eclipse in my ubuntu, I have to open a terminal and go to eclipse directory and run "sudo eclipse" command. That's not so hard but in this case, I have to leave the terminal open, as long as eclipse is running. Is there any way so I be able to run eclipse as "root" simply by double clicking on it in desktop.

like image 568
Obtice Avatar asked Jan 15 '14 06:01

Obtice


1 Answers

If you want the app to always run as root

1) Pin the application to the launcher as normal.

2) Locate the applications .desktop file which will be in either:

/usr/share/applications/APPNAME.desktop
~/.local/share/applications/APPNAME.desktop
or somewhere else, use locate .desktop|grep APPAME
3) Open with gedit:
gksudo gedit /usr/share/applications/APPNAME.desktop
4) Change then line

Exec=APP_COMMAND
to

Exec=gksudo -k -u root APP_COMMAND
5) Save

This command will also keep your environment which is very usefull if you need to connect to others servers and use your private key.

To add a quicklist option to 'Run as root'

Follow steps 1, 2 and 3 above

If the launcher currently doesn't have any other quicklist options, just append this to the end of the document

X-Ayatana-Desktop-Shortcuts=Runroot

[Runroot Shortcut Group]
Name=Run as root
Exec=gksudo -k -u root APP_COMMAND
TargetEnvironment=Unity
like image 84
Charles Stevens Avatar answered Nov 01 '22 11:11

Charles Stevens