79716377

Date: 2025-07-27 11:46:28
Score: 0.5
Natty:
Report link

As proposed I reposted this question to Unix & Linux SE and I got a solution for my problem.

The main difference between my minimum reproducable example and sudo is that sudo modifies the group id as well. In my code I have just modified the user id with setuid(). In connection with the ACL settings for group permissions

getfacl /etc/
# group: root
group::---
other::r-x

this leads to the opserved problem.

So I could solve the problem by switching the group id with setgid() in my program as well. After adding this to my code the program has access to the configuration file after dropping root privileagues.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Holger