[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Group ID



Michael Wardle wrote:

On Thursday, February 20, 2003 01:05, Russell Shaw wrote:
When a program access a config file, does it use the group ID of the
programs own binary, or can it be set differently from within the
program?

If the SGID bit is not set on the executable (normal), the program inherits the permissions of the user who invoked the executable, and so the permissions of the user's primary group.

If the SGID bit is set on the executable (abnormal), the program inherits the permissions of the group that owns the executable file.

A process can access a file using a different group by first calling setgid() or setegid() if it has the necessary permissions.

Inside a program, you can test what permissions you have by using calls such as access() and stat(). If you are unable to edit and recompile the program, you could try watching what calls it makes with strace.

Hope this helps

If i had to regenerate a config file that a program uses, is it possible to
detect what GID the program uses if it is set from within the program?




Reply to: