setuid on a sh script file

From: Bousquet Francois (Francois.Bousquet@cgi.com)
Date: Wed Feb 16 2005 - 15:29:54 EST


Ok here is my problem :

I need to delete pdf report files generated by an application on a folder on
a regulay basis. I need to keep the files of the last 7 days.

The files to delete are own by the weblogic user, group other :

-rw-r--r-- 1 weblogic other 8647 Feb 8 16:00 report_48_717.pdf

I have a batch job that is running daily under the authority of another user
(adminsm) and I want it to be able to delete those files.

So I have create a small script :

#!/bin/sh
find /path/to/report/to/delete -mtime +7 -type f -exec rm {} \;

and give it the following permissions

-rwsr-x--- 1 weblogic adminsm 294 Feb 2 10:16 rmxRapGenere.sh

adminsm is a member of the adminsm group.

With these permission, the adminsm user should be able to execute the
rmxRapGenere.sh script with weblogic user authority ? Isn't that the use of
a setuid permission ?

The problem is that the script is execute with adminsm authority, I can see
it in the "ps -ef" output and I can't delete the files (I've got a
permission denied on the rm command).

Is it like this that the setuid permission should work ?

Does the setuid affects the execution of the script and all sub command
(find & rm) ?

I am on Solaris 7 and my ufs mount have the suid option.
/dev/dsk/c0t0d0s0 / ufs rw,suid,dev=800000,largefiles
1100741267
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:30:11 EDT