Questions tagged [xattr]

Extended attributes (commonly called "xattrs") are a way to associate metadata with files/directories in the filesystem.

Filter by
Sorted by
Tagged with
18
votes
2answers
45k views

What's the meaning of output of lsattr

I'm wondering what the output of lsattr means.It prints so oddly as follows,when I have tried: lsattr /usr. $ lsattr /usr -----------------e- /usr/local -----------------e- /usr/src -----------------...
18
votes
1answer
14k views

How do I get a dump of all extended attributes for a file?

Getfattr dumps a listing of extended attributes for a selected file. However, getfattr --dump filename only to dumps the user.* namespace and not the security.*, system.*, and trusted.* namespaces....
16
votes
6answers
23k views

How to clone/copy all file/directory attributes onto different file/directory?

I want to copy the attributes (ownership, group, ACL, extended attributes, etc.) of one directory to another but not the directory contents itself. This does not work: cp -v --attributes-only A B cp:...
15
votes
1answer
2k views

State of ZFS xattr support in FreeBSD

I'm trying to work out whether or not, or rather to what extend, xattrs are supported in FreeBSD using ZFS. I've read some conflicting information. zfs get xattr lists it as on (default) for /, /usr ...
13
votes
1answer
21k views

preserving extended attributes with cp/rsync

When copying with cp, the extended attributes are not preserved, even with explicit cp -a --preserve=all /source /dest or cp -a --preserve=xattr /source /dest The same is with rsync, i.e. ...
11
votes
1answer
3k views

How are extended attributes stored and preserved?

I have a small question about extended file attributes. Assume I label my files with metadata in extended attributes (e.g. to account for the integrity - but this does not matter for my question). The ...
10
votes
3answers
6k views

Tell if a folder/file is hidden in Mac OS X

I know you can set or unset the hidden flag of a folder/file by doing chflags hidden foo.txt and chflags nohidden foo.txt. But is there anyway of telling whether the folder/file is currently hidden ...
10
votes
2answers
5k views

Difference between xattr and chattr

What is the relation and the difference between xattr and chattr? I want to know when I set a chattr attribute in Linux what is happening inside the Linux kernel and inode metadata.
9
votes
1answer
11k views

find files with extended attributes [duplicate]

Can I use find to find all files which have extended attributes set? Let's say, I want to find all files with +i, immutable attribute in /foo and its subfolders. I could not find any, mention of ...
8
votes
1answer
7k views

how to remove quarantine from file permissions in os x

I downloaded a .pem file and my Mac OS X (10.8.2) added an @ sign at the end of the file permissions. This is causing file permission issues. I can't seem to remove the quarantine flag. I even tried ...
8
votes
2answers
15k views

`chattr +i` error on NFS

I'm trying to secure my authorized_keys file to prevent it from being modified. I run this: [root@localhost]# chattr +i authorized_keys chattr: Inappropriate ioctl for device while reading flags on ...
6
votes
4answers
14k views

How to set `chattr +i` for my `/etc/resolv.conf `?

My os: debian9. The filesystem on my disk: $ sudo blkid | awk '{print $1 ,$3}' /dev/sda2: TYPE="ext4" /dev/sda1: TYPE="vfat" /dev/sda3: TYPE="ext4" /dev/sda4: TYPE="ext4" /dev/sda5: TYPE="swap" Now ...
6
votes
1answer
3k views

What does the 'a' attribute in lsattr mean?

I was trying to remove some old history from my .bash_history file, but I was receiving this message: [john ~] /home/john $ mv .bash_history .bas mv: impossible to move `.bash_history' to `.bas': ...
6
votes
1answer
2k views

Approaches to prevent user from deleting home folder

I think prevent home folder from deleting is a very good idea. So I search possible approaches to do that. I that's what I’m find: Use chattr +i /home/user - even root can't can add/delete/rename ...
5
votes
1answer
7k views

What is the effect of “chattr +a” on a directory

The a Linux file attribute is often documented as applicable to files. chattr(1) manpage: A file with the 'a' attribute set can only be open in append mode for writing. ext4 wiki: 0x20 File ...
5
votes
1answer
515 views

Linux File Capabilities are lost when I modify the file. Is this expected behavior?

When I modify a file, the file capabilities I had set earlier are lost. Is this the expected behavior? I first set a file capability: $ setcap CAP_NET_RAW+ep ./test.txt $ getcap ./test.txt ./test....
5
votes
1answer
2k views

What does the command “chattr +c /some/dir/” do?

I'm trying to keep a bunch of plain text files compressed using the extended attribute option - c on a debian ppc64 system. I ran the following commands: # mkfs.ext4 /dev/test/compressed # mount /dev/...
5
votes
1answer
3k views

Extended attribute on symbolic link

I'm trying to set some extended attributes on a symbolic link on Fedora 15. According to setfattr's usage, there is an option -h for such purpose: setfattr 2.4.44 -- set extended attributes Usage: ...
5
votes
1answer
573 views

What are costs of storing xattrs on ext4, btrfs filesystems?

I imagine that adding n xattrs of length l of to f files and d directories may generate costs: storage path resolution time / access time ? iteration over directories? (recursive find over (fresh ...
5
votes
2answers
1k views

Unison and extended file attributes

I have two machines, one Debian, one Ubuntu, both on ext4 with extended file attributes enabled in fstab. getfattr and setfattr are installed and work perfectly on both machines locally. However, ...
5
votes
2answers
2k views

Immutable bit on AIX?

Under Linux I can: chattr +i SOMEFILE so that even root can't modify the SOMEFILE. Are there any similar solutions for AIX?
4
votes
1answer
1k views

What is the effect of setting immutable bit on /boot partition [closed]

What is the effect of setting immutable bit on /boot partition with perspective of security. is it advisable to set the immutable bit (-i) to everything under /boot? Will it enhance or degrade the ...
4
votes
1answer
4k views

In docker, “chattr: Operation not permitted while setting flags on file”

I'm ssh'ed into a local Centos 7 docker container* and I'm trying to run sudo chattr +i file1 but I'm getting an error: chattr: Operation not permitted while setting flags on file1 What's going on ...
4
votes
1answer
969 views

What is this seemingly base64 data set by setfattr?

I have written a short shell script that simply wraps setfattr in a slightly more convenient form for setting the extended attribute that corresponds to a free-text comment: #!/bin/sh test "$2" &&...
4
votes
2answers
1k views

See extended attributes with coreutils ls on Mac

I have coreutils installed via MacPorts on my Mac running OS X 10.8.4. I have ls set to use the coreutils version of ls [(GNU coreutils) 8.21] when available: if [ -e /opt/local/libexec/gnubin ]; ...
4
votes
1answer
2k views

Can't set extended attributes on ext4 on fedora 22 - operation not supported

I am trying to get extended attributes working on Fedora 22. I can't seem to be able to set the attributes even on my files, but I can read them. Here's how it looks: [jarek@localhost ~]$ cd /tmp/ [...
4
votes
1answer
5k views

change location of $HOME/.Xauthority

Is it possible to change the location for .Xauthority, to something other than $HOME/.Xauthority ? AFAIU, this file is being created every time I log into LXDE, by my login manager slim. The problem ...
3
votes
2answers
4k views

What does file version mean: lsattr -v

lsattr -v gives me the "version number" of given file(s). What does this mean? On Redhat 7.3, I could've sworn all the version numbers were 1 except those I changed with chattr -v. On Fedora 11, ...
3
votes
2answers
5k views

How can I give files extended attributes in mac os x?

How can I give files extended attributes in mac os x? Mac os x doesn't have the 'setattr' command.
3
votes
2answers
5k views

Why doesn't `getfattr -d` show anything?

The successful command from which I started: getfattr -n system.ntfs_times /media/hdd/oldfolder/ output getfattr: Removing leading '/' from absolute path names # file: media/hdd/oldfolder/ ...
3
votes
1answer
6k views

what does the “a” in chattr +ia do?

what does the a in chattr +ia <filename> do? and why would you add the a in combination with the i? note: I know the i is for immutable
3
votes
3answers
1k views

How to make a symlink read only (`chattr +i /location/symlink`)?

How can we lock a symlink so it cannot be deleted? With a normal file/directory chattr +i /file/location can achieve this but doing so with a symlink we get chattr: Operation not supported while ...
3
votes
1answer
169 views

Edit a file via a script yet maintain the osx tags

On OSX you can have tags which allows you to identify different categories of files. Here are two text files with different tags when viewed in Finder: I have a large number of these files and have ...
3
votes
1answer
380 views

Is it good practice to make an init script's lockfile immutable?

I recently created an init script, and decided to set lockfile to immutable to prevent external interference. The only downside I can think of is that if someone wanted to recursively delete /var/...
3
votes
1answer
194 views

Automatically set file attributes in a given directory

Let's say I want to set one or more attributes (in the chattr sense) on every file created in a given directory. Is there a way to achieve this automatically, like umask does for file permissions ? ...
3
votes
1answer
130 views

crontab -e, permission denied after malware infection

Caused by: My machine was infected with the redis mining worm Here are some files under /root/.ssh (it's hidden, using ls -la I can see it), I remove them and some other related files, hope it won't ...
3
votes
1answer
207 views

Richacl invalid argument when trying to set atributes

I've compiled a kernel to use richacls, and compiled the richacl's utility, (but not the e2fsprogs). I've mounted a loop file with richacl flags /root/fs_prueba_10mb on /media/ext4_con_richacl type ...
3
votes
0answers
2k views

Unable to delete files even with root, lsattr is also not responding

I have two somehow corrupt files in my second hard disk of my laptop, which has dual boot Ubuntu 15.04 and Windows 7. I keep it mounted as a ntfs formatted partition in media. I share this drive ...
2
votes
1answer
4k views

how to enable xattr support in Debian 9 (Stretch)

I have added user_xattr in ext4 but when I remount it doesn't show xattr & I installed attr & attr_dev # <file system> <mount point> <type> <options> <...
2
votes
2answers
2k views

Make directory unmodifiable or undeletable except by root

I would like to prevent a directory from being deleted, let's assume the directory has this path ~/foo is there a way to make it deletable only by the root user, without using sudo and without being ...
2
votes
1answer
2k views

Cannot set file attribute

I'm trying to use setfattr, but always get Operation not supported In my home directory, I'm doing the following: touch delete.me setfattr -n naomi -v washere delete.me This returns setfattr: ...
2
votes
2answers
9k views

Unable to run 'sudo chmod +w /etc/hosts'

I am logged into my remote VM (running out of ESXi) as user xyz. I wanted to change my /etc/hosts to add some network names that were not visible by default. I first tried to run sudo vi /etc/hosts ...
2
votes
1answer
87 views

How does cd's “-@” parameter work?

bash's man page (and help cd) mentions that cd supports a -@ parameter ("on systems that support it") to "present a file with extended attributes as a directory containing the file attributes" Is ...
2
votes
1answer
224 views

ACL and plain old permissions

I have read a bunch of articles, but still cannot get an idea of ACL, so I have following questions. What are benefits of using ACL over old permissions (0777 for example) and changing file owner, ...
2
votes
1answer
574 views

How to utilize extended attributes for image preview?

Is there any file browsers for Linux that cache image previews, just like Windows Explorer cache them to a file named Thumbs.db? As in the latest ext3/4 filesystems, an inode can hold extended ...
2
votes
2answers
227 views

How do I delete an immutable encrypted file?

I was experimenting with encryption on an ext4 filesystem and I encrypted a file (using fscrypt) which was set to be immutable (via chattr +i). I have now lost the encryption key and uninstalled ...
2
votes
1answer
998 views

immutable-like flag for perms

Is there any chattr flag that would allow me to lock a file's unix permissons, and not change them without resetting the flag? The file itself should still be modifiable, I just want to prevent ... ...
2
votes
1answer
54 views

How to protect folder from being removed/moved, but no constraint for files inside

Here's what I want to achieve: I want to protect folder /mnt/sdmmc0p2/test from being removed or moved, but files inside can be removed. I try to use chattr +a /mnt/sdmmc0p2/test, but fail. ~# ...
2
votes
0answers
1k views

Can I mount a share and enable the user_xattr mount option?

I have a ext4 drive that is mounted using defaults mount options. It is a RedHat Enterprise Linux version 6.5, 64 bits. I can call lsattr on any file on that server. I need to share that drive with 3 ...
2
votes
0answers
644 views

Samba 3 on Arch Linux, streams_xattr behaviour

I'm running Samba 3.6.8-1 on my x64 Arch Linux installation. I recently decided to have my samba share support NTFS's Alternate Data Streams by using streams_xattr or streams_depot. With streams_xattr ...