以@ 或 + 结尾的文件权限模式

Nat*_*han 64 permissions files

我正在更改文件权限,我注意到某些权限模式以@as in-rw-r--r--@或 a +as in结尾drwxr-x---+。我查看了 chmod 和 chown 的手册页,并搜索了不同的帮助论坛,但我找不到关于这些符号含义的任何信息。

Mar*_*ich 41

+意味着该文件设置了额外的 ACL。您可以使用以下方式设置它们setfacl并使用以下方式查询它们getfacl

martin@martin ~ % touch file
martin@martin ~ % ll file 
-rw-rw-r-- 1 martin martin 0 Sep 23 21:59 file
martin@martin ~ % setfacl -m u:root:rw file 
martin@martin ~ % ll file 
-rw-rw-r--+ 1 martin martin 0 Sep 23 21:59 file
martin@martin ~ % getfacl file 
# file: file
# owner: martin
# group: martin
user::rw-
user:root:rw-
group::rw-
mask::rw-
other::r--
Run Code Online (Sandbox Code Playgroud)

@个人还没有见过,但根据这个线程,它表示扩展属性,至少在 MacOS 上。试试xattr -l这样的文件。

  • 只是一个简短的说明:它看起来不像 OSX 有 setfacl 或 getfacl。相反,它将额外的功能打包到 chmod 中。马丁的回答为我指出了正确的搜索词,它打开了这个页面:http://www.thomaskeller.biz/blog/2011/06/04/acls-on-mac-os-x (4认同)

slm*_*slm 24

OSX 上的 @ 意味着它们是扩展属性。见这里:http : //scottlab.ucsc.edu/~wgscott/xtal/wiki/index.php/Extended_Attributes

例子

$ ls -lF *.pdf
-rw-r--r--@ 1 wgscott  staff   222K Feb 27 17:08 1229.pdf
Run Code Online (Sandbox Code Playgroud)

@ 告诉您该文件具有某种形式的扩展属性与之关联。我们来看一下:

$ xattr -l 1229.pdf

com.apple.metadata:kMDItemWhereFroms:
0000   62 70 6C 69 73 74 30 30 A1 01 5F 10 37 68 74 74    bplist00.._.7htt
0010   70 3A 2F 2F 77 77 77 2E 73 63 69 65 6E 63 65 6D    p://www.sciencem
0020   61 67 2E 6F 72 67 2F 63 67 69 2F 72 65 70 72 69    ag.org/cgi/repri
0030   6E 74 2F 33 32 33 2F 35 39 31 38 2F 31 32 32 39    nt/323/5918/1229
0040   2E 70 64 66 08 0A 00 00 00 00 00 00 01 01 00 00    .pdf............
0050   00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00    ................
0060   00 00 00 00 00 44                                  .....D

com.apple.quarantine: 0000;49a88e87;Safari.app;|com.apple.Safari
Run Code Online (Sandbox Code Playgroud)


小智 19

对于那些搜索为什么他们不能在 mac osx 上编辑文件末尾带有“@”或“+”的人来说,原因可能与元数据有关,例如该文件是通过 Time Machine 备份复制的终端而不是文件浏览器。

两个步骤将删除元数据并使其在 MacOS 上再次可写:

# Remove the metadata attributes
xattr -c <some file>

# Remove the file ACL(s)
chmod -N <some file>
Run Code Online (Sandbox Code Playgroud)