martes, 18 de diciembre de 2018

Linux extended file attributes

I just discovered a couple of nice linux commands that seem to be quite orthogonal and suckless, and that probably allow for all sorts of nice tricks.

Extended attributes are like the -rwxrwxrwx but allow for more subtle meanings.

On the one hand we have chattr, which allows to add about 10 different attributes to files and directories with a very specific meaning:
  • a - append only
  • c - compressed
  • d - no dump
  • e - extent format
  • i - immutable
  • j - data journaling
  • s - secure deletion
  • t - no tail-merging
  • u - undeletable
  • A - no atime updates
  • D - synchronous directory updates
  • S - synchronous updates
  • T - top of directory hierarchy

On the other hand, we have the command 'attr' (not nstalled by default in ubuntu, but it's just one apt-get away).

This one serves as a kind of general tag:value system for files and directories.  It feels like it's a feature that can be overused to extremes to create not only tagging systems but acls (there's already getfacl), complex permissions or just hide info in this kind of "plists" scoped by file.

No hay comentarios: