Is it possible to start a fully independant p开发者_如何学Gorocess with QProcess with elevated user privilleges?
For example if my c++/qt application is run as a limited user, can my c++/qt application start another independant process with admin rights?
I am implying that the admin username and password is available inside the c++/qt application that is doing the launching of the 3rd party application.
In windows you should create a manifest for your application that specifies the privilege level it needs to run in. Then all you have to do is start the application. You will get a UAC prompt on newer windows version. But that is required and (IMHO) correct. There is no way of going around this.
Under linux you should on installation set a sticky bit to your application with the correct user-rights for what you want to do.
There is no direct way as far as I know but you could start with via the runas command since you do have the password for the administrator account.
In case you don't know the runas command, simply type it in a command shell and it should give you all the information you need.
There are platform-specific ways to do this, by piping in the input. In Linux, it's
system("echo PASS | sudo -u root -S COMMAND");
(source) That's for php but should work amywhere.
精彩评论