Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
As far as I know, the Linux/ Unix filesystem does not distinguish between appending and writing, so there is no way to do this directly. I stand corrected
You could allow write permission only for a dedicated user, who would run a program that appends the data it reads from a socket/pipe. Effectively, write permission on the pipe == append permission on the file.
Last edited by ntubski; 11-24-2014 at 10:15 AM.
Reason: Apparently many Linux file systems do support this
With SElinux you can grant append-only capability if you are willing to go through the work to create a new type and set up all the needed access permissions. Of course you would have to be running in enforcing mode for that to be effective.
chattr and lsattr utilities on Linux and the attributes they manipulate were originally specific to the Second Extended Filesystem family (ext2, ext3, ext4), and are available as part of the e2fsprogs package. The functionality has since been extended to many other Linux file systems, including XFS, ReiserFS, JFS, OCFS2 and others, although not all file systems support all flags.
a - append only: Writing to a file will only allow the file to be opened in append mode for writing. That is you cannot redirect output to overwrite the file, only append to it. Most normal file edit operations, like opening the file with a text editor, will most likely fail as the program will attempt to overwrite the file with the changes and "permission denied" will be displayed. This attribute can only be set by an account with superuser privileges.
Also, generally speaking, this sort of file-access has pretty severe limitations. Consider, for example, the problem of what-to-do if more than one process wishes to append to the file at the same time. Given that the operating system will, of course, do it properly, the order of the records that would get written-to the file would of course be random. None of the programs could, so to speak, "see" what they are writing. Construction of any sort of data-structure would be impossible. Really, it would only be useful for some kind of log-file. And if you want to do that, a simple "logging daemon" that accepts network-connections or pipes is a much more satisfactory solution. As long as the daemon can be trusted to do its job correctly, it alone defines what sort of requests it will and won't respond-to.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.