Qt World Summit: Register Today!

Missing CAP_NET_ADMIN permission when executing app through Qt Creator

  • I'm coding a program using the Bluetooth APIs of Qt and when I try to compile it for Linux I get the following error:

    qt.bluetooth.bluez: Missing CAP_NET_ADMIN permission. Cannot determine whether a found address is of random or public type.

    I can fix that by calling the following command and executing the executable after the change:

    sudo setpcap CAP_NET_ADMIN=eip <filename>

    The problem is that I have to do this every time I recompile the code. Is there any way to add this command to the building process for Linux without affecting the builds for Windows and Android?

  • Lifetime Qt Champion

    Well you can run a shell command (or .sh) and make it only apply to linux.
    sorry for not providing links but should be fairly easy to google.

  • Following your advice I just added the QMAKE_POST_LINK entry in the .pro file, but when it calls the command it's stuck waiting for a password for sudo. Is there any way to provide the password?

Log in to reply