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
0 votes
0 answers
6 views

Can SELinux limit the scope of a binary which has capabilities set?

I would like to give my application (running unprivileged) a set of capabilities which allows it to: chown/delete some files not owned by it set quota for users but limit the scope of its "...
user avatar
1 vote
1 answer
44 views

Ideas to clear user xattrs from files without get/setfattr

I have a directory containing a root filesystem that I SquashFS and then mount as r/o on other boxes. However, before SquashFS'ing, i want to clear all the user-namespace xattrs from the filesystem. ...
user avatar
0 votes
1 answer
60 views

Using ntfs-3g, how to parse Windows extended attributes automatically?

Using xattrs, one can access Windows extended attributes using the following command getfattr -h -n system.ntfs_ea Ntfs_Mount_Point/some_file The problem is instead of an attribute list, it returns a ...
user avatar
0 votes
2 answers
47 views

A directory that is owned by some non-superuser, but can't be deleted by them

Is it possible to create a directory that its owner can't delete? Let's say I have directory bar owned by user foo, and I'd like to create a subdirectory bar/baz, also owned by foo, such that: foo ...
user avatar
  • 715
1 vote
0 answers
50 views

Append only attribute for directories

I want to create a directory which is undeletable, and that you can only add files, not delete any file therein. I was reading the man chattr page and I came across attribute a A file with the 'a' ...
user avatar
-1 votes
1 answer
125 views

Find "latest" path, filename, date, and time at every level of a folder subtree with Bash [closed]

Using Bash, I want to find for any specified directory and its subtree the filename, creation_date and creation_time for the file last created in that directory. For example, the output would be: /...
user avatar
  • 9
0 votes
1 answer
22 views

How to lsattr directory only?

I have a directory called pub on a Ubuntu 20.04 server, that I wish to protect from deletion, and I found https://askubuntu.com/questions/504151/how-to-prevent-directory-from-being-deleted-by-user so ...
user avatar
  • 360
0 votes
0 answers
44 views

Some subdirectories created on Linux via SMB not visible on macOS

I have the following network shares setup with 3 machines: Machine A (Ubuntu 20.04) owns a directory dir and exposes it with SMB smbd --version → Version 4.13.14-Ubuntu Machine B (Ubuntu 20.04) ...
user avatar
  • 101
2 votes
1 answer
44 views

Bug or feature: Cannot link immutable file

I had set the immutable attribute for a file that shouldn't be changed until it is deleted (The file was a backup image of a virtual machine). As it seems the file also cannot be hard-linked, i.e. it ...
user avatar
  • 804
0 votes
1 answer
40 views

Set immutable bit for specified time

It's possible to set immutable bit for a specified range of days? I was trying to understand how Veeam11 can change the attribute after a few days for immutable backup
user avatar
  • 1
1 vote
0 answers
34 views

Mount disk of non-selinux machine on machine with selinux enabled

I have a backup server, which has selinux enabled. It has an external hard drive attached to it to store the backups (ext4). I also have a workstation which has selinux disabled. If I run rsync from ...
user avatar
  • 813
0 votes
0 answers
74 views

Reading HFS+ extended attributes under Linux

I have an external USB SSD which is formatted in the HFS+ filesystem (created on a Mac) and some of the files on it have extended attributes (xattrs). I can partially read the extended attributes on ...
user avatar
  • 325
0 votes
1 answer
70 views

Can stat show if file is hidden?

I'm using stat like this: stat -f "%Sp %p %l %Su %u %Sg %g %z %a %N %Y" /* I need also to tell if the file is hidden or not (MacOS). The . notation is not enough. MacOS hides more files. ...
user avatar
2 votes
1 answer
735 views

/usr/bin/ssh and /usr/sbin/sshd can't be moved to update openssh-server and openssh-client because of immutable attribute

Ubuntu Server can't be upgraded because it says that openssh-sftp-server package have unmet dependencies The following packages have unmet dependencies: openssh-sftp-server : Depends: openssh-client (...
user avatar
3 votes
1 answer
600 views

How to apply and use Rich Access Control Lists with BTRFS

I am just learning about Rich Access Control Lists on Linux. My immediate objective is to give members of the group the same rights as the owner for a subdirectory tree (all files and directories ...
user avatar
  • 15.5k
0 votes
1 answer
122 views

rsync --itemize-changes lists some xattr differences, but getfattr shows no difference

On my Arch Linux machine, I want to verify btrfs backups of snapshots using rsync. The following rsync command is used to check for changes: sudo rsync -n --itemize-changes --checksum -a --delete --...
user avatar
  • 13
1 vote
0 answers
17 views

Prevent deletion of folder by accidentally moving or deleting parent folder that has no immutable attribute [duplicate]

In the PARENT_FOLDER I store subfolders with some works I am producing each week, e.g. right now I have these contents: ~/PARENT_FOLDER/StuffProducedTwoWeeksAgo/... ~/PARENT_FOLDER/...
user avatar
  • 1,007
1 vote
1 answer
548 views

Btrfs - max xattr size?

What is actual max allowed size of btrfs xattr? I tried to test this on few systems and got entirely different results (between 11kB and 15kB) so I'm not sure what actually determines this size and ...
user avatar
  • 1,213
3 votes
1 answer
343 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 ...
user avatar
4 votes
3 answers
3k 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 ...
user avatar
  • 12.7k
2 votes
2 answers
1k 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 ...
user avatar
  • 123
3 votes
1 answer
177 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. ~# ...
user avatar
2 votes
0 answers
121 views

lsattr returns different results depending on how it's run

I'm using lsattr on a linux container on the contents of a mounted drive that's been mounted using SAMBA and am seeing some interesting results. If I run lsattr in quick succession, I get differing ...
user avatar
  • 121
8 votes
1 answer
9k 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 ...
user avatar
0 votes
1 answer
142 views

How to make files undeletable but moveable in linux server?

I am managing some folders on our server. The server runs: REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux" REDHAT_SUPPORT_PRODUCT_VERSION="7.6" I have created a directory in "/srv/" and named it "...
user avatar
3 votes
1 answer
179 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 ...
user avatar
0 votes
1 answer
1k views

Is there a tool in Linux to add an extended attribute to a file?

The getfattr tool is used to get the extended attributes of a file, but is there a tool to add an extended attribute to a file?
user avatar
1 vote
0 answers
249 views

How to mount ecryptfs and preserve individual SELinux tag of underlying files?

I am trying to mount ecryptfs on a system that uses SELinux (e.g. Cent-OS), and I want to preserve the security tag of all individual underlying files. Using mount -o command I can set the security ...
user avatar
  • 93
1 vote
2 answers
459 views

How can I prevent ROOT from deleting a directory, but still allow root to have full control of all files and subdirectories within it?

chattr +a would be perfect if it only applied to the root of directory, not everything from there on. Is there a way to limit chattr to just the one folder (e.g. the opposite of -R as is normally ...
user avatar
  • 11
0 votes
1 answer
4k views

Inappropriate ioctl for device while reading flags on <file>

I am unable to set or view file attributes using lsattr and chattr commands on Reiser File System. Following result is observed: chattr +i Temp.txt chattr: Inappropriate ioctl for device while ...
user avatar
2 votes
1 answer
6k 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> <...
user avatar
6 votes
4 answers
31k 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 ...
user avatar
  • 213
2 votes
0 answers
724 views

How to synchronize files differing only in xattr

I am using rsync to synchronize my files but I have come to a problem when in source I add some tags (or in general probably modify xattrs) to the file, no other changes and it seems that this does ...
user avatar
  • 441
5 votes
1 answer
975 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 ...
user avatar
1 vote
0 answers
63 views

Ftp'd files have secure deletion attribute set

I have recently upgraded to a LAMP server running on Centos 7, with vsftpd for uploading files. As a hack, I use the secure deletion attribute to tag certain files to keep track of which ones ...
user avatar
2 votes
1 answer
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: ...
user avatar
  • 633
1 vote
0 answers
316 views

let rm truncate files

A friend of mine has one directory (/var/mail) on his Linux machine where rm seems to truncate files if he has no write permissions on the directory. I like this feature and wonder how could I do the ...
user avatar
  • 9,191
2 votes
2 answers
3k 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 ...
user avatar
1 vote
2 answers
1k views

Why does "attr -l ." tell me about an "selinux" attribute that "attr -g selinux ." refuses to read?

I'm setting up a Fedora (Core) 24 system from scratch, and ran into this oddness: > sudo attr -l . Attribute "selinux" has a 41 byte value for . > sudo attr -g selinux . attr_get: No data ...
user avatar
5 votes
2 answers
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, ...
user avatar
1 vote
1 answer
1k views

How to prevent a directory from being edited

How to prevent a directory (including all of its contents), from being edited? Using command chattr, you can prevent a directory from being deleted: chattr +i folder But, you can edit this ...
user avatar
  • 113
22 votes
1 answer
19k 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....
user avatar
  • 6,524
1 vote
0 answers
674 views

On MAC OS X 10.11.4 - Loss of extended file attribute when copying a file

I have a file with a comment as extended attribute. This is how I can see the attribute from the Terminal: mdls -name kMDItemFinderComment path_to_file I get the answer kMDItemFinderComment = "...
user avatar
  • 19
2 votes
1 answer
340 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, ...
user avatar
5 votes
1 answer
882 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....
user avatar
3 votes
4 answers
7k 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.
user avatar
1 vote
1 answer
369 views

OpenVZ acl support for Samba

Setting up Samba-4.3.5 as AD domain fileserver in OpenVZ container, running in ProxMox (pve-manager/3.4-6/102d4547 running kernel: 2.6.32-39-pve). Hardware node has enabled acl support for /var/lib/vz....
user avatar
  • 193
6 votes
1 answer
10k 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 ...
user avatar
16 votes
1 answer
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 ...
user avatar
  • 3,991
2 votes
1 answer
485 views

Automatically set append attribute for newly created files/folders?

I'm trying to setup a folder so that users can only create or modify files/folders in it, but not delete them. I tried the 'chattr +a' command and got different results in RHEL5.8 and RHEL6.5 ...
user avatar