{"id":158,"date":"2019-02-20T15:30:19","date_gmt":"2019-02-20T07:30:19","guid":{"rendered":"http:\/\/132.145.126.25\/?p=158"},"modified":"2019-02-20T15:30:20","modified_gmt":"2019-02-20T07:30:20","slug":"xattr-related-permission-error","status":"publish","type":"post","link":"https:\/\/www.tsihyoung.com\/index.php\/en\/2019\/02\/20\/xattr-related-permission-error\/","title":{"rendered":"&#8216;Forbidden: You don&#8217;t have permission to access file_name&#8217; Caused by Mac OS Extended Attribute"},"content":{"rendered":"\n<p>Recently, I came across &#8216;Forbidden&#8217; error several times when I was trying to download files I had uploaded from Mac to my website running Apache2. And I found if the file was generated by Linux and uploaded also from Linux, then everything would be OK.<\/p>\n\n\n\n<p>This error is (sometimes) caused by Mac OS Extended Attribute which can be observed by the &#8216;@&#8217;-mark-ended attributes, e.g. &#8216;-rw-r&#8211;r&#8211;@&#8217;, when using &#8216;ls -l&#8217;. We can further check the contents of &#8216;@&#8217; by using xattr. This tool will show some thing like following,<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>com.apple.lastuseddate#PS<br> com.apple.metadata:_kMDItemUserTags<br> com.apple.metadata:kMDLabel_xxxxxx<br> com.apple.quarantine<\/p><\/blockquote>\n\n\n\n<p>Note that it is the last line &#8216;com.apple.quarantine&#8217; that caused this annoying permission denied error. We can remove this attribute by using<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>xattr -d com.apple.quarantine file_name<\/code><\/pre>\n\n\n\n<p>After above treatment, we can now get rid of this error.<\/p>\n\n\n\n<p>But this attribute is actually not always causing error, I am not really sure whether it is the root of this permission error.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently, I came across &#8216;Forbidden&#8217; error several times when I was trying to download files I had uploaded from Mac to my website running Apache2. And I found if the file was generated by Linux and uploaded also from Linux, then everything would be OK. This error is (sometimes) caused by Mac OS Extended Attribute [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"post_formats":[],"languages":[9],"post_translationss":[],"class_list":["post-158","post","type-post","status-publish","format-standard","hentry","category-programme-en"],"guten_post_layout_featured_media_urls":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"guten_post_layout_landscape_large":false,"guten_post_layout_portrait_large":false,"guten_post_layout_square_large":false,"guten_post_layout_landscape":false,"guten_post_layout_portrait":false,"guten_post_layout_square":false,"sciencexlite-blog-thumb":false},"_links":{"self":[{"href":"https:\/\/www.tsihyoung.com\/index.php\/wp-json\/wp\/v2\/posts\/158","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tsihyoung.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tsihyoung.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tsihyoung.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tsihyoung.com\/index.php\/wp-json\/wp\/v2\/comments?post=158"}],"version-history":[{"count":0,"href":"https:\/\/www.tsihyoung.com\/index.php\/wp-json\/wp\/v2\/posts\/158\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tsihyoung.com\/index.php\/wp-json\/wp\/v2\/media?parent=158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tsihyoung.com\/index.php\/wp-json\/wp\/v2\/categories?post=158"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tsihyoung.com\/index.php\/wp-json\/wp\/v2\/tags?post=158"},{"taxonomy":"post_format","embeddable":true,"href":"https:\/\/www.tsihyoung.com\/index.php\/wp-json\/wp\/v2\/post_formats?post=158"},{"taxonomy":"language","embeddable":true,"href":"https:\/\/www.tsihyoung.com\/index.php\/wp-json\/wp\/v2\/languages?post=158"},{"taxonomy":"post_translations","embeddable":true,"href":"https:\/\/www.tsihyoung.com\/index.php\/wp-json\/wp\/v2\/post_translationss?post=158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}