Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!tut.cis.ohio-state.edu!pt.cs.cmu.edu!cadre!pitt!unix.cis.pittsburgh.edu!msw From: msw@unix.cis.pittsburgh.edu (Matt S Wartell) Newsgroups: comp.unix.questions Subject: SUID usage accounting under 4.2BSD Summary: does real or effective user id get charged for cpu usage on SUID prog. Keywords: SUID accounting 4.2BSD Message-ID: <18663@unix.cis.pittsburgh.edu> Date: 7 Jul 89 14:42:45 GMT Reply-To: msw@unix.cis.pittsburgh.edu (Matt S Wartell) Distribution: na Organization: University of Pittsburgh Lines: 29 Under 4.2BSD, who gets charged for the running of an SUID program? I have a program that needs to write to a log-file which should not be world writable. Therefore I am using a 4755 mode on the program which is owned by me. If another user runs my program, will he be charged for the cpu usage or will I? If I am charged for time spent while another user is executing my program, can I `reverse the charges' with: write_logfile(); seteuid(getuid()); /* program now runs under user's real ID and get charged to him */ Finally, if I can use the above code, can I do the following: euid = geteuid(); seteuid(getuid()); /* do unprivileged processing */ seteuid(euid); /* do privileged writes */ I don't think so. Is there perhaps another way of doing this without, say, forking a child which resets its euid and piping info back to a privileged parent? Please respond via mail, I will summarize. -- matt wartell, university of pittsburgh msw@unix.cis.pittsburgh.edu