Invoking a system() call that requires root rights


#1

Hi,

For a particular application I need to change some network settings that require root rights from a GUI app. I do this through some system() calls. When launching the application from a terminal I‘m prompted to enter the password in the Terminal and everyting works fine.
Now I moved to CLion where this doesn‘t work when launching the Application trough the debug button - I just don‘t get any prompt to enter the password in the CLion console and the application will just hang at that point. And I think this will also happen if the GUI Application will be launched throug a Desktop icon and no terminal is shown.

So is there any possibility to get a popup Window to enter the password in Linux?


#2

Create a separate command line tool (let’s assume this executable is called mynetworkchange) which does the network settings changes and launch
gksudo mynetworkchange with JUCE’s ChildProcess class. gksudo is a graphical tool asking for admin privileges.

Edit: Layout