Hi,
I have several directories under an upload directory where differnt users upload their files (with exxactly the same file name every week) using their own user ids.
There is a requirement that once any user uploads the file I have to clean that file and remove extra whitespaces and unreadable characters.
I have a cleanup script which runs under an admin user (basically a group owner user say xyz) account which has access to all these directories.
Once I do the clean up the owner of the uploaded file gets changed to admin user and then next time when any user tries to upload their file again they get permission denied error as the file with same name exist with different owner.
Question is
- How to give access to the individual user to over write the file own by the admin user or
- How not to change the owner of the file to the admin user while cleaning up the file.
Note: All the users are part of the same group whose owner is the admin user mentioned above. i.e. in the /etc/group file all the user ids who uploads the file are listed under the group id
xyz:!:212:userid1,userid2,userid3
my cleanup script runs as user xyz and the ownership gets changed to xyz and then the userid1, userid2 and userid3 are not able to upload their files.
the owner of the upload directory is userid1
abc 100 5/21/2011 rwxrwxr_x userid1
before upload
abc.csv 100 5/21/2011 rw_r__r__ userid1
after upload and clean up
abc.csv 100 5/21/2011 rw_r__r__ xyz
Next time when user userid1 tries to upload gets permission denied error.
Hope I am not confusing here.