Help with Openbox menu to run command

Hello I am using crunchbang plus plus on a dell/wyse 5470 thin client and I want to add a OpenBox menu item to turn on and off my wireguard vpn with the sudo wg-quick up wg0 and sudo wg-quick down wg0 commands

currently I have


<span style="color:#323232;"><menu id="menu-1473049" label="Wireguard">
</span><span style="color:#323232;">      <item label="VPN On">
</span><span style="color:#323232;">        <action name="Execute">
</span><span style="color:#323232;">          <command>wg-quick up wg0</command>
</span><span style="color:#323232;">        </action>
</span><span style="color:#323232;">      </item>
</span><span style="color:#323232;">      <item label="VPN Off">
</span><span style="color:#323232;">        <action name="Execute">
</span><span style="color:#323232;">          <command>wg-quick down wg0</command>
</span><span style="color:#323232;">        </action>
</span><span style="color:#323232;">      </item>
</span><span style="color:#323232;">    </menu>
</span>

but nothing happens when I click them, also I tried with sudo in the command name and it didnt work either and Im not sure how it would ask for my password from a menu command? is this even possible?

lemmyreader,

You could configure sudo without password only for the wg-quick command. Not a beautiful solution and also not super easy to configure with sudo but it’s an option. Much easier solution is to install doas or opendoas and leave sudo as it is. Let’s assume your desktop user is named variants and in group variants, then putting the following in /etc/doas.conf is expected to work :

permit nopass :variants cmd wg-quick

If your user is not yet in a group, and you add a new group, remember that making such a change usually requires logging out and logging in again because the group changes become visible. Then test with doas wg-quick up wg0

Snarwin,

You could try the solution suggested in this reddit thread, and use systemctl to start and stop wireguard instead of wg-quick.

Drathro,

Maybe not too helpful, but could point you in the right direction: you used to be able to use “gksudo” to get the graphical popup requesting your password in lieu of sudo which would only ask for a password in terminal. I believe gksudo is deprecated/non-existent at this point but there’s got to be an alternative out there. Best of luck!

jeremias,
@jeremias@social.jears.at avatar

Alternatively you can launch sudo inside a terminal window. For example with xterm: xterm -e sudo [some command] [some arguments] *[…]*This will pop up a terminal window to type your password in.

Pretty sure almost all terminal emulators have a similar argument.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • linux@lemmy.ml
  • Durango
  • DreamBathrooms
  • InstantRegret
  • magazineikmin
  • osvaldo12
  • everett
  • Youngstown
  • khanakhh
  • slotface
  • rosin
  • thenastyranch
  • ngwrru68w68
  • kavyap
  • normalnudes
  • megavids
  • ethstaker
  • GTA5RPClips
  • modclub
  • cisconetworking
  • mdbf
  • tacticalgear
  • cubers
  • provamag3
  • tester
  • anitta
  • Leos
  • JUstTest
  • lostlight
  • All magazines