Skip to contentSkip to conversation

question about Ext2/3 append-only attributes

DISCUSSION Xin Zhao 3 participants 3 messages May 3, 2005

lore
Share & tools
lore

Xin Zhao

author
#0 lore raw

I read some specification says that if append-only is set to a directory, you can only create or modify files in that directory, but no delete.

But when I tried this attribute on a directory, I was not able to create new files in that directory. let's say the derectory is /dev, I set it to be append-only with:

chattr +a /dev.

Then I cannot create new files in it with command cp /dev/aa /dev/bb, not that aa is a normal text file here.

Why the result conflict with the specification? Is there anyway to make a directory really append-only? Thanks in advance!

-x

#1 lore raw
Quoted 3 lines · Xin Zhao

I read some specification says that if append-only is set to a directory, you can only create or modify files in that directory, but no delete.

Could you be more specific on "some specification", and convince us that what you read wasn't in fact wrong about things?

Quoted 3 lines

But when I tried this attribute on a directory, I was not able to create new files in that directory. let's say the derectory is /dev, I set it to be append-only with:

Well, creating a new file implies creating a new entry in the directory pointing at the inode, which is "appending" to the directory. So this isn't at all surprising, and I'd consider the spec that says "create or modify" to be broken.

Were you possibly thinking of the +t (sticky) bit on a directory, which when set restricts who can unlink the file?

#2 lore raw
In reply to Xin Zhao
Quoted 3 lines · Xin Zhao

I read some specification says that if append-only is set to a directory, you can only create or modify files in that directory, but no delete.

I suspect that your interpretation of the specification is wrong.

+a says that files can only be opened in append mode--O_APPEND. It is very specific as to what it allows.

Perhaps you want the sticky bit, +t, set on the directory?

Robert Love