[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: protect a file


An excerpt from the man page of chattr(1):

       A file with the `a' attribute set  can  only  be  open  in
       append  mode  for  writing.  Only the superuser can set or
       clear this attribute.

Thus, what he probably needs is:

# chattr +a <filename>

This would only allow appending to the file.  If you want to give the
user permission to modify the document, then as Raju correctly pointed
out, it will also give the user the power to overwrite that document.


>>>>> "Raju" == Raju Mathur <raju@xxxxxxxxxxxxxxx> writes:

    Raju> Hey Anuj, If he can modify it in an editor, he can delete
    Raju> all the contents and replace them with new contents.  That's
    Raju> as bad as overwrite.

    Raju> If you want him to be able only to append, you'll probably
    Raju> have to hack the kernel "open" and "creat" system calls.

    Raju> Regards,

    Raju> -- Raju

>>>>> "Anuj" == Anuj Kumar <Anuj@xxxxxxxxxxxxx> writes:

    Anuj> Result, My Directory permison is 755. and chown root.root .
    Anuj> My file inside this diretory.  The File permisson is 766 and
    Anuj> chown root.root.

    Anuj> You are right.  In this case a user can not delete the file.
    Anuj> User can modify the file.

    Anuj> But still I have problem regarding overwrite. User can
    Anuj> overwite the file.

    Anuj> Can file manain any uniqe ID?  can I use any deamon?

    Anuj> Regards,

    Anuj> ----- Original Message ----- From: Raju Mathur
    Anuj> <raju@xxxxxxxxxxxxxxx> To:
    Anuj> <linux-delhi@xxxxxxxxxxxxxxxxxxxxx> Sent: Tuesday, November
    Anuj> 14, 2000 8:27 PM Subject: [linux-delhi] protect a file

    >>> Hi Anuj,
    >>> You can implement this by giving the user write permission on
    >>> the file without giving her write permissions on the directory
    >>> in which the file is located.
    >>> Regards,
    >>> -- Raju
    >>> >>>>> "Anuj" == Anuj Kumar <Anuj@xxxxxxxxxxxxx> writes:
    Anuj> Hello Dear, I want protect a file. This is an excel file.
    Anuj> User can use the file, read the file, modify the file.  But
    Anuj> user can not remove the file And can not overwrite the file.
    Anuj> How can do this ??  Waiting your valuable guidance.
    Anuj> Regards, Anuj