Recently, I came across ‘Forbidden’ 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 which can be observed by the ‘@’-mark-ended attributes, e.g. ‘-rw-r–r–@’, when using ‘ls -l’. We can further check the contents of ‘@’ by using xattr. This tool will show some thing like following,
com.apple.lastuseddate#PS
com.apple.metadata:_kMDItemUserTags
com.apple.metadata:kMDLabel_xxxxxx
com.apple.quarantine
Note that it is the last line ‘com.apple.quarantine’ that caused this annoying permission denied error. We can remove this attribute by using
xattr -d com.apple.quarantine file_name
After above treatment, we can now get rid of this error.
But this attribute is actually not always causing error, I am not really sure whether it is the root of this permission error.