"permission denied"error even though I supposedly have full privipedge

Here is the code

apple$ find . -name states.txt
find: ./Documents/Library: Permission denied
./Documents/states.txt
apples-MacBook-Pro:~ apple$ ls -la ./Documents/Library
ls: Library: Permission denied
apples-MacBook-Pro:~ apple$ sudo ls -la ./Documents/Library
Password:
total 0
drwx------@  3 root   staff   96 Mar  2  2021 .
drwx------@ 26 apple  staff  832 Oct 29 12:57 ..
drwx------   2 root   staff   64 Mar  2  2021 Logs
apples-MacBook-Pro:~ apple$ 

AS you can see, I should have rwx priviledges, yet Find still says permission denied for libraryfolder.why?


Solution 1:

No, I do not see that in the output you provided. The parent directory .. grants you rights; the Library directory itself . doesn't seem to.

According to the line for . (which represents the "Library" directory itself), that directory is owned by root and only grants rwx permissions to its owner (i.e. root) but not to anyone else. The same goes for the "Logs" subdirectory within.

To make it easier to see the permissions of just a directory on its own, use ls -ld <path>.