Linux program unable to access files in group

Posted by user1064665 on Super User See other posts from Super User or by user1064665
Published on 2011-11-24T21:26:42Z Indexed on 2011/11/25 9:53 UTC
Read the original article Hit count: 198

Filed under:

I'm having trouble configuring things on linux so that a program can access certain files. Let's call it pgm A. It has uid uA and gid gA. In addition, uid uA is listed in /etc/group as a member of group gX. The problem is that pgm A cannot access files for which the uid is root and the gid is gX, but only when pgm A is called from another program, pgm B, which also runs as user uA.

If I su as user uA and run pgm A from bash, it has no problem accessing files in group gX.

But if another program, pgm B, which also runs as user uA, forks and execs pgm A, pgm A cannot access the files. I've verified that pgm A is indeed running as user uA, group gA, when launched from pgm B. So, if uA is a member of group gX, why can't the program access files which are readable by group gX? It's as if the operating system is ignoring the fact that user uA is also in group gX.

© Super User or respective owner

Related posts about linux