I would like that my Unix users can only run a specific command
insecurecommand with a controlled list of arguments stored in a file.
The only solution I have found at this time is to :
- Create a new security group called
Limit the execution of the command to this group:
chown root:cmdxg /.../insecurecommand chmod 750 /.../insecurecommand
Create a setgid wrapper, which executes the command:
ls -al /.../mywrapper -rwxr-sr-x 1 root cmdxg /.../mywrapper
The only problem is that
insecurecommand is executed with
gid=cmdxd and not with the users real gid. However, I'd like to avoid running the
insecurecommand command setgid.
If in the wrapper code, I go back to real gid with seteuid(), it can't run the
insecurecommand anymore because the process lost the
Is it a way to run a command that needs privileged gid rights, but with the real gid ?
Maybe I need to decompose the program execution ?
-> first load the binary with the privileged effective gid -> go back to the real gid -> run the program
But how can I do this ?
Any ideas ?