Questions tagged [xattr]

Use the xattr tag for questions about extended attributes on files in a (Linux or macOS) file system.

Extended attributes are descriptions of the file stored separately from the file data. They are read by special system calls. People often first encounter them as a result of seeing an @ after the permissions in the output from ls -l. (The related symbol, a +, indicates that there are ACLs — access control lists — associated with the file.)

On macOS (or Mac OS X), you find out about the extended attributes with the @ option to ls. For example, a file might have the extra attribute:

$ ls -l@d Cscope
drwxr-xr-x@ 3 someuser  staff  102 Mar  8 21:49 Cscope
    com.apple.quarantine     30 
$

indicating that the directory had been copied from the internet and had not yet been marked as clean/safe. The Time Machine software makes extensive use of extended attributes too.

For macOS, the system calls are listxattr(), flistxattr() getxattr(), fgetxattr(), removexattr(), setxattr(). Linux adds lgetxattr() to this set.

96 questions
0
votes
1 answer

How to exclude a specific user from a file but allow all others to read?

There is file that I want to share with everyone, except from 3 specific users. I can use the linux extended attributes to create an ACL and give access to specific users, but the problem is that I don't know all the users, I know only the…
belabrinel
  • 851
  • 8
  • 15
0
votes
1 answer

MacOS: programmatically prevent backup of file to iCloud?

I am dealing with MacOS, not iOS, and I want to ensure that a file is not backed up to iCloud (if iCloud is enabled). How is that done?
xyz
  • 83
  • 1
  • 6
0
votes
1 answer

Can I modify a disk image while it is open, but not "save changes"?

I have a script where I create a disk image of an SD card using hdiutil and then mount that disk image. I then write extended attributes to the files inside using xattr and important them into a program. Is there any way I can reverse those xattr…
arlovande
  • 81
  • 1
  • 8
0
votes
2 answers

xCode Stripping extended attributes failed / xattr

When I try to upload an app to the app store I get the following error: Stripping extended attributes failed. "/usr/bin/xattr -crs /var/folders/t2/fjp18t212bdc6kgb3pjzk81m0000gn/T/XcodeDistPipeline.ZBT/Root/Payload/testvgd.app" exited with a…
CorneeldH
  • 593
  • 1
  • 8
  • 21
0
votes
1 answer

Modify ext4 file system to add custom attribute for files

I'm not very experienced in Linux kernel so I don't have idea how to do this. What I have to do is to modify ext4 file system to add custom attributes in files (e.g. to add original location when file was created). So, not to add custom attribute to…
Milan
  • 41
  • 7
0
votes
1 answer

Could NFS be mounted on one of openstack swift storage node?

Currently, I got one CentOS in virtual box with openstack swift running which is installed by SAIO. Question: Data would not stored in the node which I mount nfs. For example, I create a container by curl, the output returns 201. But there is no…
tommyjin
  • 1
  • 2
0
votes
1 answer

How to code sign macOS binary to stop firewall permissions requests?

Bowtie app is here: http://bowtieapp.com. The binary but not the source is available. It has the problem on macOS Sierra 10.12.5 Beta that an active firewall causes it to request firewall permissions on every boot. I suspect this can only be…
kevinlawler
  • 930
  • 1
  • 9
  • 19
0
votes
0 answers

How to get the extended file attributes from a file, without opening the file

My partner and I have been smashing out heads agaisnt the wall for a while on this. We need to get a look at a files extended file attributes to check for a flag we have placed in there. To do this we believe we need the dentry of the file, we…
Ben Atkinson
  • 53
  • 1
  • 8
0
votes
2 answers

How do I add the “extended attributes” on a file in Mac OS X?

How do I add the extended attributes? I am using excel with local file links and opening files but I need to add extended attributes to each file. So I do not get the prompt Grand File Access. My files looks like File-01.html...File-99.html. I need…
Whitecat
  • 3,882
  • 7
  • 48
  • 78
0
votes
0 answers

Data, UnsafeMutablePointer and extended attributes in Swift 3

In swift 2 I had an NSURL extension for working with extended attributes and it included this: func setAttribute(name: String, value: String) { let data = value.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)! …
dbmrq
  • 1,451
  • 13
  • 32
0
votes
1 answer

Calculating the value returned by NSURLFileAllocatedSizeKey using OSX system calls

For the question to make sense, let me guide you through the whole test case, so please bear with me. Let's create a file. echo 0 > ~/SAMPLE This makes a simple file that is 2 bytes in size (echo appends new line by default, and that doesn't hurt…
mnovakovic
  • 61
  • 1
  • 6
0
votes
1 answer

OSX: How to set ACL on a folder

How to set ACL to a folder similar to Safari.app? ls -lde /Applications/Safari.app/ drwxr-xr-x@ 3 root wheel 102 Jun 22 13:25 /Applications/Safari.app/ 0: group:everyone deny delete I have tried using : sudo chmod -R +a "group:everyone deny…
ZestyZest
  • 911
  • 13
  • 27
0
votes
1 answer

Reformat xattr output and store it in MySQL using a BASH script

I have a script that collects a bunch of file system object information (hashes, dates, etc) and stores it in a MySQL database (one row per object). The script is running in Bash in Mac OS X 10.10.4 (MBP). I would like to store the HFS+ Extended…
Mike
  • 25
  • 1
  • 1
  • 5
0
votes
1 answer

xattr produce error when clear rights

I have directory with inherited rights: drwxrwxrwx+ 5 root admin 170 Feb 16 18:27 autotests 0: group:everyone inherited deny add_file,add_subdirectory,directory_inherit So I want to clear extended rights and do this on parent…
Dmitriy Demidov
  • 523
  • 2
  • 6
  • 18
0
votes
2 answers

iOS how to store a NSDictionary or JSON in a file's xattr?

I'm looking at extended file attributes for iOS and Mac files using setxattr command. From what I understand, I can store arbitrary data there, up to 128kb. How can I write and read extended attributes as if I'm dealing with a dictionary, not…
Alex Stone
  • 46,408
  • 55
  • 231
  • 407