You are not logged in.

#1 2012-06-07 22:33:09

adam777
Member
Registered: 2012-05-28
Posts: 161

[Solved] Application launcher with the ability to launch as root

Hello all,
In the process of setting up my Openbox desktop, I became really intrigued by the idea of using application launcher to access my utilities.
However, despite my searches I could not find one that enables me to launch the result (in the case of a program, not a document etc.), using root privileges.
That is, something like, "enter to launch as current user" (default behavior), "shift+enter (or something like that) to launch as root" (basically "sudo result").
The ideal would be something like the above, but using a special prefix/suffix in the search could also be OK.

Thanks, Adam.

Last edited by adam777 (2012-06-09 04:10:48)

Offline

#2 2012-06-08 04:42:46

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,557
Website

Re: [Solved] Application launcher with the ability to launch as root

What launcher are you using?  Is this for gmrun?

If so, you can just enter sudo on the line with the app name, or for some you may want to check out gksu.

But what utilities do you regularly want to launch as root?  I suspect there is a much better and safer way to reach your end goal if you can clarify what that is.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2012-06-08 07:31:02

adam777
Member
Registered: 2012-05-28
Posts: 161

Re: [Solved] Application launcher with the ability to launch as root

Hi Trilby,i
I'm not using anything at the moment, still experimenting with Arch, and once I get it to a stage where it is working as I need, I'll switch over from Windows.
I do not limit myself to a certain launcher, anything that can achieve that can be considered.
As for a use case - for example, launching the web browser (Chromium) is done as a regular user, but launching power-play-switcher should be done as root, or it will be on view-only mode.
Adam.

Offline

#4 2012-06-08 19:27:37

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,557
Website

Re: [Solved] Application launcher with the ability to launch as root

I don't think I'm really getting the question then.  You will find most tools are configurable.  The simplest "launcher" might be a menu.  Take openbox's menu as an example - you write an xml file that describes the menu and the commands that should be run when that menu option is selected.  It is not uncommon to have two versions of some commands: one to launch the app as a regular user, the other to launch as root.  Some pseudo-code (and sudo code! wink )

<item label="Gparted">
    <execute>gparted</execute>
</item>
<item label="Gparted (root)">
    <execute>gksu gparted</execute>
</item>

Alternately, if you use keybindings as your "launcher" you can bind keys to "appname" or "sudo appname".  Or dmenu (theoretically) can be launched with one keybinding that will run the selected program as a normal user, or another keybinding that would then launch the selected program as root.  I say "theoretically" because, while this would be very easy to implement, I'd say it would be a very dangerous idea.

You may also want to look at modifying the sudoers file for some programs that you want to be able to run as root without using a password.  This is commonly done for the shutdown/suspend/reboot commands, but could be done for any command or program.

So, overall, I'd say figure out what launcher you want to use, then you can target your question to get a better answer.  I'd say that this should be easy to do in any launcher, but the exact method will be different based on which one you choose.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2012-06-09 04:10:32

adam777
Member
Registered: 2012-05-28
Posts: 161

Re: [Solved] Application launcher with the ability to launch as root

Thank again Trilby.
By launcher I meant something in the region of Kupfer, Launchy etc, not something menu-based as OpenBox's menu, in which case creating different entries as in your example, is obviously easily done.
I suppose I'll start with gmrun, in which, as you noted, it should be fairly easy to achieve what I need, and see if it fits my needs.
Should the need arises, I'll try to customize some other launcher to do it, and post back if I need assistance.
Adam.

Offline

Board footer

Powered by FluxBB