Xfce Forum

Sub domains
 

You are not logged in.

#1 2024-09-29 07:58:50

fixit
Member
Registered: 2015-01-19
Posts: 127
LinuxFirefox 130.0

Whopper of a mistake in a custom action

I did not anticipate this running on a 3.9 Gb image.

It got my CPU usage way up. :-)

code echo password | sudo -S geany %f /code

I only want it running on text files.

How can I avoid that?


Ubuntu-Mate 24.04

Offline

#2 2024-09-29 15:57:09

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,359
LinuxFirefox 130.0

Re: Whopper of a mistake in a custom action

Honestly, you shouldn't use sudo for this kind of stuff. You should transition to using pkexec.

To do so, first create the file /usr/share/polkit-1/actions/geany.policy with the following content:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" "https://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
  <vendor>Geany</vendor>
  <vendor_url></vendor_url>
  <icon_name>geany</icon_name>
  <action id="geany">
    <description>Run Geany as root</description>
    <defaults>
      <allow_any>no</allow_any>
      <allow_inactive>auth_admin</allow_inactive>
      <allow_active>auth_admin</allow_active>
    </defaults>
    <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/geany</annotate>
    <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
  </action>
</policyconfig>

...and save the file.

Make sure you have a polickit authentication agent running:

ps -ef | grep polkit

Then in your custom action use:

pkexec geany %f

...and you should be prompted for your password to continue.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2024-09-29 17:28:35

fixit
Member
Registered: 2015-01-19
Posts: 127
LinuxFirefox 130.0

Re: Whopper of a mistake in a custom action

Thanks.


Ubuntu-Mate 24.04

Offline

Registered users online in this topic: 0, guests: 1
[Bot] CCBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.007 seconds, 7 queries executed - Memory usage: 524.5 KiB (Peak: 529.74 KiB) ]