Linux local directory permissions as question-marks for non-root

On files read suffices to check the permissions. You need read AND execute on folders to ls them.

chmod -R a+X ./deploy_dir

Capital X to only set execute on folders (and files that already have execute bit set).


Reading the permissions of a file requires calling stat(2) on it, and that requires the execute/access permission on the containing directory (all directories in the path). This is actually the same with every other system call that takes a filename. However, reading the contents of a directory (the list of file names) only requires read access on the directory.

In your sample snippet:

~/somedirectory $ ls -l .../bin/D\:
ls: negaliu pasiekti '.../bin/D:/workspace': Permission denied
viso 0
d????????? ? ? ? ?            ? workspace

ls tried to call stat(".../bin/D:/workspace"), got an error and complained. On some systems you can get partial information from the readdir/getdents calls along with the file names, without needing to use stat. Like here, workspace is shown to be a directory.

And here we see there's no x bit for any user:

~/somedirectory $ ls -ld .../bin/D\:
drw-r--r-- 3 user01 user01 4096 Rgs 27  2016 .../bin/D:

As root, you get a full listing, since being root ignores the permission bits entirely.