Fake deletion of files

Hi, This is possibly an odd request to do with permissions as I seem to have tied myself up with these!

I have the following directory (see below) that contains files that the 'usergrp' user needs to be able to 'delete' files from.

drwxr-s--- 2 usergrp usergrp 512 16 Feb 14:37 discard

Without changing the directory permissions and giving the users write permissions is there a way of writing a script that the user can call to 'delete' the file, which in reality just moves the files out of the way to a predefined directory. The user should feel empowered, but essentially they've not actually deleted the file.

Any help with this would be much appreciated. If anything is unclear about how I've explained this then let me know and I will see if I can explain myself a little clearer!

One way: create an alias for rm that points to your script. The script calls rm for any file that is not in the 'special' directory - for files in the special directory it calls mv.

A real problem with this approach is checking symbolic links.

Excellent :smiley:

Now the issue that I have is what permissions to set on the 'delete' script that will allow the user to execute it and for it to then subsequently move the files using the correct permissions.