PDA

View Full Version : How to get root permission inside qt program?



manojpatidar
18th September 2014, 10:41
I run my QT app without sudo permission but during running phase of the app I need to install the .deb so I am running the command dpkg -i mydeb.deb with qprocess in QT or some other commands which needed to sudo permisssion.

I do not need the user interaction to enter the password for the same. So how can I do the same in QT app in ubuntu 14.04 ? Thanks

wysota
18th September 2014, 16:58
You need to use a mechanism to elevate process permissions. Qt has nothing to offer in this regard, look for platform-dependent solutions (e.g. PolicyKit/PolKit)

ChrisW67
18th September 2014, 22:59
You could just use QProcess to run exactly the same sudo command as your user would from the command line.