Having my app prompt the user for sudo privilages

My app needs sudo in order to modify files it needs to modify. Most Linux apps can bring up a GUI prompt for this password. Is there a shell command or other way to have this prompt pop up? It seems to be a function of the system and not custom made prompts as apps all share the same style prompt.

Do you use our MBS Xojo Plugins?

We have the LinuxSuMBS class there.

i remember a app can also belong to a group in linux. (and files and folders too)
if this group have the file modify privilege for this folders you not need to request root/admin permission.

I figured MBS would but this is all going to be open source and so I don’t think I can use your plugins (as I am pretty sure they are closed source). I do use them when I am not making open source software though!

hm I will have to look into this, I don’t want the user to have to create a group with privileges though, so it must be created out of the box. I just need to see if root/admin is needed to make this group (which I am assuming it will).

I might just need to make my own prompt and pass it to the shell but I don’t like the idea as it is insecure.

Of course you can use our plugins in an open source project.
Just don’t put in the license key for a public repository.

And then for building, you can put in the key, build and upload binaries.

1 Like

I found my solution instead of sudo with the shell commands you just need to use policy kit:

pkexec [command]

and it will pop up the system GUI to input the sudo credentials

Not to hijack this thread, but @Christian_Schmitz, can MBS do this on MacOS? Would be nice to not have to resort to AppleScript for this.

I use Monkeybread Xojo plugin - AuthorizationMBS class but I think there was also a newer way?

1 Like

There is but it’s practically useless.