Help!How can I run ontape utility by other?
Posted in 1999
Topics: Backup & Restore
My project has a requirement.
I want other user to run ontape utility!
But ontape can only be run by informix user
how can I do it?
please give me some advise!
Knowing a little more about the 'other user' would be helpful. But here
are some things that will work (and I know some of them are out of the
question):
1. Give the other user the informix password.
2. Use sued, which is freeway that allows limited execution of commands
by others.
3. Write a simple C program that (1) changed id to Informix and (b)
executes ontape. After program is compiled, change the mode to 4755.
This C program would look something like this (this flew off my fingers
and is not tested):
define <stdio.h>
define <limits.h>
define <stdlib.h>
define INFX_UID ?????? /if* fill in the questions marks with
actual id if*/
main(int argc, char** argv)
{
char *informixdir;
chart ontape[PATH_MAX];
if ((informixdir = getenv("INFORMIXDIR")) == NULL)
{
fprintf(stderr, "INFORMIXDIR not set\\n");
exit(1);
}
sprintf(ontape, "%s/bin/ontape", informixdir);
setuid(INFX_UID);
execv(ontape, argv);
fprintf(stderr, "execv failed, errno=%d\\n", errno);
exit(1);
}
After compilingf this program, chmod on the a.out to 4755. When the user
executes this it will do ontape as informix.
BUT, before you do any of this, I would want to know the WHOLE
situation. Perhaps it can be solved without brining out the big guns.
reborn wrote:
> My project has a requirement.
>
> I want other user to run ontape utility!
> But ontape can only be run by informix user
>
> how can I do it?
>
> please give me some advise!