I am using libdbus library and have written code in C language in which I am trying to fetch the screen lock and unlock events using "com.canonical.Unity.Session","IsLocked" entry. The compilation is successful but when I run the code in superuser mode then I get the following error:

Connection Error (Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.)

When I run the code in Normal User mode (after exiting from root user), then it works absolutely fine.

Is there a way I can run this code as root user? As my entire application runs in root user environment.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.