79

I have a file with the following permissions on my MacBook Pro:

-rwxr-xr-x@ 1 root wheel 101K Feb 29 17:09 apachectl

What does the @ stand for? I can't execute the file and this is the only thing that's standing out to me. How can I get rid of it?

Just as some background, I copied this from a Time Machine backup.

VinnyD
  • 1,223

5 Answers5

51

If the file or directory has extended attributes, you'll see an @ in the permissions field. For extended security information (ACLs), you'll see a +.

From man ls on OS X:

-@      Display extended attribute keys and sizes in long (-l) output.

The xattr program can be used to display and manipulate extended attributes. Take a look at what's there before deciding to go while deleting those attributes, though. Definitely take a quick look at the man page for xattr too.

A quick example from some example PHP compromise code I keep around for reference:

$ ls -@l php-compromise.php 
-rw-r--r--@ 1 user  group  502620 Jul  5  2011 php-compromise.php
    com.apple.FinderInfo        32 
    com.apple.TextEncoding      15 
29

Thanks to @Jeff for the correction. I was miss-remebering.

  • The @ is displayed with a extended attribute is set
  • The + is displayed for an ACL.
  • IF you have both an attribute and a ACL then you see @.

Run the command ls -le filename to see if it has any ACLs set.

Since your problem seems to be with accessing the file, I bet you have a ACL set in addition to an extended attribute.

To get rid of an ACL run echo | sudo chmod -E filename for a file or echo | sudo chmod -R -E directory name for a directory.

See the chmod man page.

Zoredache
  • 550
  • thanks for the response. how can I get rid of it? – VinnyD Mar 01 '12 at 01:17
  • Updated with an answer that I believe should work. – Zoredache Mar 01 '12 at 01:20
  • @Zoredache ACL permissions come with a plus sign. The @ is "extended attributes." –  Mar 01 '12 at 01:22
  • Yeah, I am seeing that as I double check. I must have remember backwards. And what happens when a file has both? – Zoredache Mar 01 '12 at 01:24
  • Nevermind, I got a mac booted up. If you have an @ extended attribute and + acl set, it appears that ls will show a @. Since he is having problems accessing a file, it seems likely to me that the problem more likely that he has a problem with an ACL. – Zoredache Mar 01 '12 at 01:33
  • The attributes don't control access permissions, but can be interpreted by applications. The ACLs are, well, ACLs. Now, since he's talking about time machine, time machine files are often marked as immutable. They're really kind of a pain to cope with. Good to know about the "+@" combo showing as "@" –  Mar 01 '12 at 01:35
  • I though immutable just blocks changes. I didn't think it prevented a file from being executed? – Zoredache Mar 01 '12 at 01:42
16

The @ stands for extended attributes, in addition to the standard unix file permissions.

Check the extended attributes:

ls -l@

Reset all extended attributes for a single file:

sudo xattr -c <filepath>

Reset all extended attributes recursively:

sudo xattr -rc <directory>
sudo chmod -R -N <directory>

Checked on macOS High Sierra (10.13) and macOS Mojave (10.14.6).

user3439894
  • 58,676
15

With the apple quarantine attribute, chmod is not enough to remove it.

You need to remove the attribute explicitly:

sudo xattr -d com.apple.quarantine my_file
grg
  • 201,078
Riot
  • 251
-1

I found that the -E or -N are actually invisible even when using sudo. The only way I could fix it was by logging in as root