>> Timothy Shimmin <tes@xxxxxxxxxxxxxxxxxxxxxxx> writes:
> I use a small program, xfstests/src/runas, to set up the
> effective uid, e-gid, and supplementary groups for a process.
> Could you do the following as root to verify it is working:
> [root@sagan src]# runas -u 10001 -g 10002 -s 10003 -s 10004 id
> uid=0(root) gid=0(root) euid=10001 egid=10002 groups=10003,10004
I'm not getting that. The problem is runas uses system. It eventually
executes /bin/sh, which is a symlink to bash, which in turn will reset
privileges on start up (a patched bash might not do this if called as
"sh", but the one installed here does). The attached runas.c solves
this:
# ./runas -u 10001 -g 10002 -s 10003 -s 10004 /usr/bin/id
uid=0(root) gid=0(root) euid=10001 egid=10002 groups=10003,10004
(I'm using execv, replace with execvp if you want things to be searched
in the PATH)
--
Marcelo
runas.c
Description: Text document
|