Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if Qt c++ application is running as sudo [duplicate]

I have a Qt GUI application that must be ran as sudo. Right now, I have a script that they are supposed to execute to start program as sudo which adds an argument that I check to make sure they launched from the script.

This technique works, but it doesn't really check if sudo, it only checks that script launched it.

Any thoughts on doing a more precise sudo test?

like image 375
Dan Shaffer Avatar asked Apr 28 '15 17:04

Dan Shaffer


1 Answers

I would use getuid or geteuid.

Here is a previously answered question similar to yours.

like image 187
abuv Avatar answered Nov 18 '22 00:11

abuv