Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

owner+grp of files

Status
Not open for further replies.

iribach

Technical User
Oct 12, 2002
211
CH
hello

in a c-prog (on solaris) i set the uid+euid to NEWuser, gid+egid to NEWgrp, using set(e)(uid|gid), sure NEWusr AND NEWgrp are well defined
in /etc/(passwd|group) both to abba,
then i create a file (it does not matter how, (f)open, creat, system, exec.. and so on);

as ROOT i run the program, AND the created file:
is owned by ROOT and has ROOT-grps grp

i expect: owner is the NEWusr and grp is NEWgrp.
the prog is owned by a normal-user:

---------------
if(getuid()) exit(1); /* user != root */
setuid(111); seteuid(111);
setguid(111); setegid(111);
system("ls -l >filename");
system("ls -l filename");
-----------------

the output: -rw-rw-r-- 1 root root 89879 Apr 19 15:34 filename
expected is:-rw-rw-r-- 1 abba abba 89879 Apr 19 15:34 filename

i also tried, setting usr+grp execflag on exec: chmod 6755 exec

any idea, thanks a lot, iribach
 
bad day :(
an error in the calling sh-script.
thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top