I am managing some folders on our server. The server runs:


I have created a directory in "/srv/" and named it "test". I have added another directory called "archived" inside "test".

I have created project_managers user group and added some users to this group. project_managers have read/write/execute permission for "/srv/test/" recursively.

I want the project_managers to be able to move files from one directory to another but not to be able to delete the files entirely from the server.

For example I want project_managers have permission to move "/srv/test/my_code.py" to "/srv/test/archived/" but do not have permission to delete "/srv/test/my_code.py"

I have done: sudo chattr -R +i /srv/test/

It prevents both deleting and moving files.

Is it possible to make files undeletable but moveable?

1 Answer 1


To answer you question: a move and a delete are pretty similar, I think you need a different strategy.

I would put the directory under version control, not only because it appears to be code.

The advantage of a version control system is that you have file history. you could simply run a scheduled task, say every hour that checks if changes were made, using, say git, and apply the changes to version control.

That way, you can allow the people to move stuff, delete stuff, does not matter what ... it is still in version control and retrieval is only a command away.

The other thing with version control systems, like git, is that you have a backup mechanism integrated. You can pull any changes over to one or more other systems AND when I say changes, it is in fact complete file history ... including any change ever made.

With text files, the overhead in storage in minimal, it only ever stores the changes that were made.

The only thing the others are not allowed to touch is the version control system. If you use git, it will create a .git directory, this will contain all the important information ... you could also use other systems like mercurial.

If you really want to capture all changes as they are made, you could try git watch which can watch a git repository, including all subfolders and files therein, and insert any change into git. Better, even, gitwatch can send the changes as they happen to a git on another server (full backup, full history).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .