dchoulette
Programmer
Hello.
I run an awk script owned by root with suid bit on.
The effective uid of the process running the awk script is root as expected (I can access to file only readable by root), but within the awk 'system' function the effective uids are lost.
For example, in my script the command:
system("id"
show only uid and gid and no more 'euid' or 'egid'.
The only explaination I see is that awk fork a shell (usr/bin/sh) to execute the system command and that the shell reset effective uids to the real uids if launched without the flag -p (as explained in 'man sh').
I tried the following:
system("/usr/bin/sh -p -c 'id'"
without success.
Is there a way to execute system commands in awk without losing the effective uid ?
Thanks for your help.
I run an awk script owned by root with suid bit on.
The effective uid of the process running the awk script is root as expected (I can access to file only readable by root), but within the awk 'system' function the effective uids are lost.
For example, in my script the command:
system("id"
show only uid and gid and no more 'euid' or 'egid'.
The only explaination I see is that awk fork a shell (usr/bin/sh) to execute the system command and that the shell reset effective uids to the real uids if launched without the flag -p (as explained in 'man sh').
I tried the following:
system("/usr/bin/sh -p -c 'id'"
without success.
Is there a way to execute system commands in awk without losing the effective uid ?
Thanks for your help.