You are not logged in.

#1 2019-06-16 15:27:40

IlIlIl
Member
Registered: 2019-05-29
Posts: 4

How do I run a gui application as sudo with a keybind in openbox?

Hello I want to make a keybind in rc.xml that starts the application as sudo and preferably hides the terminal after inserting the password.

I tried putting the command directly in rc.xml but this doesn't work.
<keybind key="W-g">
      <action name="Execute">
        <startupnotify>
          <enabled>true</enabled>
          <name>Geany</name>
        </startupnotify>
        <command>sudo /usr/bin/geany</command>
      </action>
    </keybind>

And I tried with a shell script, but it just shows the loading cursor and afterwards does nothing (no windows appear not even a terminal)(yes i did chmod +x).

<keybind key="W-S-g">
      <action name="Execute">
        <startupnotify>
          <enabled>true</enabled>
          <name>Geany</name>
        </startupnotify>
        <command>/home/eye/.config/openbox/shellstart/geanysudo.sh</command>
      </action>
    </keybind>

What is the best way to do this?

thank you for your time

Last edited by IlIlIl (2019-06-16 15:32:46)

Offline

#2 2019-06-16 15:38:39

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

Re: How do I run a gui application as sudo with a keybind in openbox?

And what's in genysudo.sh?  You mention a terminal; does genysudo.sh start a terminal?  Do you want to have to enter your password in a terminal?

Why would you want to run geany as root at all?  That seems like a bad idea.

Last edited by Trilby (2019-06-16 15:39:09)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#3 2019-06-16 15:52:32

IlIlIl
Member
Registered: 2019-05-29
Posts: 4

Re: How do I run a gui application as sudo with a keybind in openbox?

Trilby wrote:

And what's in genysudo.sh?  You mention a terminal; does genysudo.sh start a terminal?  Do you want to have to enter your password in a terminal?

Why would you want to run geany as root at all?  That seems like a bad idea.

echo "sudo /usr/bin/geany" > geanysudo.sh

Yes I want to enter pw in terminal and then hide the terminal. I am working in /opt/srv/ that's why and to easily edit config files that aren't in home I also want the same for my filemanager.

Offline

#4 2019-06-16 16:03:58

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

Re: How do I run a gui application as sudo with a keybind in openbox?

Files in /opt/srv/ could be in a group your user is in and group writable.

As for system config files, you certainly don't need a full IDE to edit them.

Anyhow, if you really want to do this as you describe, you need to start a terminal: nothing in your binding or script launches any terminal, so of course there is no terminal in which to enter a password.

But do you need a terminal and sudo?  This is what gksu is for (or used to be, perhaps that's been replaced).  There is also sudoedit.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

Board footer

Powered by FluxBB