I am writing a robotics program in C++, using Qt for the GUI, where each thread needs access to hardware. The library which accesses the hardware is called pigpio, and it modifies /dev/mem, so it needs root access.

The problem is that the user does not have root access, plus they are interfacing with the GUI and they shouldn't be bothered with having to put in a password anyway. I tried to setuid, but Qt does not support it, and neither does GTK+. How can the user run the GUI as root without password? The system is Ubuntu 18.04 on Raspberry Pi 3B+.


It seems the best solution will be to use pigpiod, rather than pigpio, since the daemon can be run on startup by adding

#!/bin/sh -e
exit 0

to the file


Unfortunately, the API is different for pigpiod, so I will have to rewrite a lot of the code, but a test program is working.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.