Showing posts with label access control lists. Show all posts
Showing posts with label access control lists. Show all posts

Feb 3, 2014

Extended file attributes, ACL

Does file system support?
sudo tune2fs -l /dev/sda1 | grep "Default mount options:"
# Default mount options:    user_xattr acl
Extended file attributes

Extended attributes: the good, the not so good, the bad.
On Linux and FreeBSD, cp will only preserve xattrs if given the option --preserve=xattr, also implied by the -a option. cp will not duplicate attributes by default, which is a reasonable default choice, even if it will be wrong in some situations (where you will have to use the options).

Extended Attributes – lsattr and chattr
  • a : append only 
  • c : compressed 
  • d : no dump 
  • e : extent format 
  • i : immutable 
  • j : data journalling 
  • s : secure deletion 
  • t : no tail-merging 
  • u : undeletable 
  • A : no atime updates 
  • C : no copy on write 
  • D : synchronous directory updates 
  • S : synchronous updates 
  • T : top of directory hierarchy
lsattr test.txt
chattr -a test.txt
SELinux (англ. Security-Enhanced Linux — Linux с улучшенной безопасностью) — реализация системы принудительного контроля доступа, которая может работать параллельно с классической дискреционной системой контроля доступа. Входит в стандартное ядро Linux. Также для функционирования SELinux требуются модифицированные версии некоторых утилит (ps, ls, и тд), которые обеспечивают поддержку новых функций ядра, и поддержка со стороны файловой системы.
setfattr -n user.comment -v "this is a comment" testfile
getfattr testfile
# user.comment
getfattr -n user.comment testfile
# user.comment="this is a comment"

POSIX Access Control Lists on Linux
DAC model
man 5 acl
getfacl dir
setfacl -m user:joe:rwx dir
man chacl