msw@unix.cis.pittsburgh.edu (Matt S Wartell) (07/07/89)
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