Neo,
Thanks for reply.
Can you please give me example how to do exec process with the UID, you want.
Please see my test case below :-
[IPLAY] $ ls -al a.ksh
-rwx------ 1 oracle dba 46 Apr 15 15:54 a.ksh
Where a.ksh is as follows :-
#!/usr/bin/ksh
# There are more lines of code here that should be executed
# as oracle user.
# but the line below (sqlplus) should be executed as the calling user i.e. real user.
sqlplus system/cub4@idev1
*************************************
This is C Wrapper script.
[IPLAY] $ cat a.c
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
/**********************************************
This is the wrapper script
***********************************************/
int main(int argc, char *argv[]) {
int i;
i=system("/local1/USERS/oracle/a.ksh");
if ( i == 0 )
return 0;
else
return 1;
}
I have compiled gcc a.c -o a
Now, I have changed permission of a as 4711
So when I will execute a as some other user e.g. sanjay,
the sqlplus session is started but I want to start the sqlplus session as the sanjay user which is the real user, oracle is the effective user in this case.
Thanks
Quote:
Originally posted by Neo
One suggestion is to fork() and perhaps exec() a process with the UID you want. Then have the new process make the system call with the UID you gave it.......
You can't change the UID of a running process..... but you can fork new processes and give UIDs to the new processes.