I am observing the following behaviour, and want to know if it is expected.
I am trying to run disk usage ( du
) as user2
on a directory test_directory
which is owned by user1
.
If I change the permissions to allow everyone full access (using chmod 777 test_directory
), then both user1
and user2
are able to properly see the disk usage, as expected:
However, if I restrict executable access for other users (using chmod 776 test_directory
), then user2
is not able to run du
and a permission error occurs:
In addition, the directory shows as having 4096 bytes size in the case of the error.
Why are executable permissions needed for a user to be able to request the disk usage with du? I would have naively expected that only read permissions are needed (i.e.
chmod 774
). Actually it seems that both read and execute permissions are needed to run du (i.e.chmod 775
).Why does the directory size default ot 4096 bytes in this case?
Thanks!