Run project in QT as admin in linux

When running several projects made in Qt, some ones require to be run as super user to work correctly, my question is:

How can I configure the '.pro' file to compile the project asking for this ?

1 answer

  • answered 2018-11-08 00:22 Ted Lyngmo

    I don't think the .pro file is the correct place (but I don't know QT). You could take a brutal approach and check for the real and effective user id's and just quite early

    if(getuid()!=accepted_realuid) std::exit(1);
    if(geteuid()!=accepted_effectiveuid) std::exit(1);

    then ask the admins to review and install what you've done - but elevating privs are usually not needed. There are other mechanisms for that.