Is it possible to apply special restrictions for a content of a directory?

0

I want restrict permissions to the content of a directory /abc/def/:

  • disable links (symbolic or hard)
  • limit the number of write permissions pointing to the same file (e.g. to 1, so only one process can write to the file simultaneously, many can read the file)

Is it possible? and how?

Maybe it is possible to create a special file system and mount it to the this /abc/def/ directory. But then how can I apply special restrictions for a custom file system?

static

Posted 2013-03-25T01:21:15.007

Reputation: 1 087

Apart from the face value of your question, what is the objective, why do you NEED this kind of behaviour, what are your trying to achieve? – tink – 2013-03-25T02:58:44.853

I have many instances of same process (in terms of unix: many processes of the same program :) and on request they can write in the file (with resume, if the process will be crashed). So if two processes receiving the same request - they starting to write in the same file...so writing more then it should be there. – static – 2013-03-25T03:10:54.177

Answers

0

The Unix filesystems just aren't designed for this.

  • Disable links: A directory just contains links to the files, they have their separate life. Makes no sense.
  • Limit concurrent writers: Can be done by explicit locks. Again, no relation to directories at all.

vonbrand

Posted 2013-03-25T01:21:15.007

Reputation: 2 083

so, no file system (not only pure unix) can offer this functionality? so I need to do it on my own? – static – 2013-03-25T03:22:33.120

On Unix, first point impossible (unless you create your own one-link-only filesystem; it would be entertaining finding out all the stuff that blows up in that environment), second point through explicit locks (mandatory locks, probably). – vonbrand – 2013-03-25T03:24:26.997