Why does getfattr not display anything for a file that has the extended attribute bit set?
I've got a Nagios XI install running on CentOS 6.2, and want to modify the backup script. I noticed that the extended attribute bit is set for this shell script, so I want to be sure not to mess anything up when I make changes to it. I experimented and found that "cp -p" does not preserve this setting (see comment for update on this). I'm new to extended attributes on Linux, and found that there's a command 'getfattr' that is supposed to display the extended attributes, however it doesn't display anything for this file.
cd /usr/local/nagiosxi/scripts
ll backup_xi.sh
-rwxr-x---. 1 nagios nagios 2757 Jul 3 10:03 backup_xi.sh*
# nothing is displayed by 'getfattr':
getfattr -d backup_xi.sh
# and nothing special seems to be present according to 'getfacl':
getfacl backup_xi.sh
# file: backup_xi.sh
# owner: nagios
# group: nagios
user::rwx
group::r-x
other::---
Ultimately, my objective is to modify the file while preserving whatever attributes were set during the original product installation. Is there a reason why the extended attribute bit is set, even though no properties are apparently present according to getfattr?
The security.selinux
extended attribute is not shown by default by getfattr
; you must explicitly request it.
$ getfattr -d Work
$ getfattr -n security.selinux Work
# file: Work
security.selinux="unconfined_u:object_r:user_home_t:s0"