Give root permissions to an app/plugin on Linux

I have a plugin which has a preset manager build into it. It uses a rewritten version of this code.

(I use Linux, a similar preset manager worked for me on MacOS and Windows)

The problem is that XML presets are not being saved when using the plugin or the standalone version normally. I need to run it from the terminal with “sudo /path/to/the/plugin” to give it the write permissions.

Is there a way to add some kind of a window asking for the password which is going to give those permissions to the plugin each time the user wants to save a preset? Or maybe there is a way to create a custom path for saving presets so no write permission will be needed at all?

Thank you so much in advance.

Here is where I store UI settings on macOS and Windows. AFAIK this is also the usual place for presets:

        inline auto static const path =
                juce::File::getSpecialLocation(juce::File::userApplicationDataDirectory)
                        .getChildFile("Audio")
                        .getChildFile("Presets")
                        .getChildFile(JucePlugin_Manufacturer)
                        .getChildFile(JucePlugin_Name);
        inline auto static const uiPath =
                path.getChildFile("ui.xml");
2 Likes

Thanks a lot! I found the place where the path to the preset directory was created and changed it to this path. Now the plugin doesn’t need root privileges anymore.