Important: Please read the Qt Code of Conduct -

Run qt creator with root privilege

  • Hi, i add libpcap library to qt on ubuntu. now when i want to run program it need root privilege for showing network interfaces. what is simplest way for running qt qreator as root? or another way?

  • Moderators

    Please do not run Qt Creator as root! It is a huge and complex application with lots of external dependencies, so it is mostly impossible to guarantee that it will not allow someone to do something nasty with it.

    Fortunately there is usually no reason to even try: You can set up a remote linux device in Tools>Options>Devices, which can be used to access "localhost" as the root user. You can then clone the existing Desktop Kit in Tools>Options>Build & Run>Kits and replace the device type (remote linux or something similar) and then the device (with your newly created one).

    When you use this kit in your project Creator can deploy via SSH to your localhost and then run/debug "remotely".

    For this to work you will need ssh installed and running (configured to allow access to the root user!). To allow for debugging you will also need gdbserver installed. Both should be readily available for all Linux distributions.

  • I know this thread is old, but there really isn't a better working solution to this? i've tried the above, with ssh running and configured properly, even had all the ssh keys setup to allow access without a password, but nope, builds fine, but won't deploy (says deploying isnt needed...), won't run, nothing. All i get is a messagebox stating the app cannot be stopped because it isnt running.

    Something in the vain of 'run as root' and ask you for your pass via ksshaskpass or whatever, would be lovely. So far im left with just one option, kdesu the app, then attach...but wait, i need to debug the init code, so thats out of the question...frustrated isn't even close lol.

    This kind of thing really makes me hate the unix permissions system -_-, especially for someone on a home desktop, behind a router + firewall.

    Edit: Just had another look around the project page, at the options for the new remote kit, and noticed something in bright red...
    "Executable on device: Remote path not set"
    No idea what that means, or even how to set it....

    7 hours spent on just trying to get the damn thing to debug with root privs is far too much, im off to bed.

Log in to reply