We have some service which need elevated rights. And by default, they will be running in root mode. But customer is asking to use normal user instead of root.
So, I added to wheel group on centos, and tried to run the background executable to check rights, but still showing as "Must be run with root permissions".
It means, it didn't get the rights exactly.
So, please suggest me how to change the service to user with root rights instead of direct root user.
Upgrade to EL8, which has new enough versions of systemd and PolicyKit.
Provide the desired user in the .service unit (or a .service.d directory extending it)
Define polkit configuration to allow the desired users to manage-units. As themselves.