I am extending some software (of which I am not the author) that runs under GNU / Linux (Ubuntu 14.04) and consists of a manager
process and several worker
processes. The manager can start a worker by means of a command line that I can specify in a configuration file.
After starting a worker, the manager communicates with it using a pipe. For security reasons, we have decided to let the workers run under a different user than the manager (let us call them manager-user
and worker-user
). This is achieved by writing a small wrapper script that switches user with su
and starts a new worker. After this, the manager can communicate via a pipe with the worker process. This approach has been working for many months now.
As an alternative to su
, we have considered using the setuid
bit to run the workers. So we have written a C
wrapper that can be invoked by the manager to start a worker. If we configure the wrapper to be owned by manager-user
, the worker is started correctly (but, of course, with the wrong privileges). If we configure the wrapper to be owned by worker-user
and set the setuid
bit, then the workers are started but then exit because they cannot connect to the manager.
So my question is: how does running a setuid
executable affect the permission on pipes created by both the parent and the child process? Can it be that the worker processes started through the setuid-wrapper do not have permission to open the manager's pipes (or the other way round)? If this can be the case, how can we change these permissions?
I have little experience using setuid
so any information / explanation is welcome.