chattr +iaの「a」は何をしますか?

chattr +iaの「a」は何をしますか?

aは何をしますかchattr +ia <filename>?なぜと追加aしますかi注:私はこれがi不変であることを知っています。

ベストアンサー1

  The  letters  `acdeijstuADST'  select the new attributes for the files:
  append only (a), compressed  (c),  no  dump  (d),  extent  format  (e),
  immutable (i), data journalling (j), secure deletion (s), no tail-merg‐
  ing (t), undeletable (u), no atime updates (A),  synchronous  directory
  updates  (D),  synchronous  updates (S), and top of directory hierarchy
  (T).

~からマンページchattr

このフラグを持つファイルは書き込み用に開くことができません。これにより、次のような潜在的に破壊的な特定のシステムコールも防止されます。truncate()またはunlink()

$ touch foo
$ chattr +a foo
$ python
> file("foo", "w") #attempt to open for writing
[Errno 1] Operation not permitted: 'foo'
> quit()
$ truncate foo --size 0
truncate: cannot open `foo' for writing: Operation not permitted
$ echo "Appending works fine." >> foo
$ cat foo
Appending works fine.
$ rm foo
rm: cannot remove `foo': Operation not permitted
$ chattr -a foo
$ rm foo

このオプションはログファイル用に設計されています。

おすすめ記事