Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [xattr]

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

0
votes
1answer
52 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 "...
2
votes
1answer
37 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 ...
0
votes
1answer
179 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?
0
votes
0answers
32 views

Issues with attr-2.4.48 homebrew on mac

I am attempting to use attr-2.4.48 in a build, the build works on an ubuntu machine, but I am trying to get it to work on OSX, and am running into errors where functions aren't getting enough ...
0
votes
0answers
22 views

How to rename ISPConfig directories set by chattr command

I would to import a restore of a web directories to /var/www/clients/client4/web18/web managed by ISPConfig. I read ISPConfig put an attributes on this kind of directories. /var/www/clients/...
1
vote
0answers
119 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 ...
1
vote
2answers
58 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 ...
0
votes
1answer
2k 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 ...
2
votes
1answer
2k 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> <...
5
votes
4answers
4k 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 ...
1
vote
0answers
304 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 ...
5
votes
1answer
217 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 ...
1
vote
0answers
44 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 ...
2
votes
1answer
848 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: ...
1
vote
0answers
151 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 ...
1
vote
2answers
549 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 ...
1
vote
1answer
582 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 ...
5
votes
2answers
804 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, ...
0
votes
1answer
95 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 ...
15
votes
1answer
7k 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....
2
votes
0answers
455 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 = "...
2
votes
1answer
120 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, ...
4
votes
1answer
253 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....
3
votes
2answers
3k 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.
1
vote
1answer
324 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....
4
votes
1answer
5k 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 ...
15
votes
1answer
1k 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 ...
1
vote
1answer
182 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 ...
1
vote
4answers
159 views

I need to make a file undeleteable, but allow it to be modifiable and renameable

I have a script that checks for the presence of a file, and if it exists, read a list of email addresses from it to send notifications. When I don't need to be notified, for instance, when I'm at work ...
3
votes
0answers
1k 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 ...
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/ [...
1
vote
0answers
97 views

Is it normal that I need u+w to set extended filesystem attributes?

I noticed that on panfs, Python's copystat fails when the source file does not have the u+w permission bit set; setting attributes fails with Permission denied command line equivalent: (attr_set: ...
-1
votes
2answers
186 views

if I delete usr/bin/chattr would other components of the system be affected?

I would like to delete chattr, as in /usr/bin/chattr, I am using Linux Mint, do you think other parts of the system would be affected?
3
votes
1answer
319 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
137 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 ...
2
votes
0answers
953 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
2answers
3k views

Trouble understanding why getfattr -d doe not 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/ ...
5
votes
1answer
3k 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 ...
6
votes
1answer
1k 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 ...
7
votes
1answer
8k 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 ...
1
vote
0answers
35 views

Is the purpose of setting the version number of a file using chattr similar to optomistic locking in a database?

For instance if you record the version number before editing the file, and check it again before saving the file, you can be assured that nobody else wrote to the file while you were editing it. (...
4
votes
1answer
747 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" &&...
9
votes
2answers
4k 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.
11
votes
1answer
16k 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. ...
3
votes
1answer
172 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 ? ...
1
vote
2answers
1k views

File compression - how to implement in Linux

I would like to be able to compress certain files (that I need to keep, but use rarely) on disk. I noticed that chattr +c flags a file for compression, but it doesn't seem to actually compress files. ...
2
votes
2answers
8k 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 ...
8
votes
2answers
13k 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 ...
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 ...
3
votes
2answers
855 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 ]; ...