0

I download some files through FileZilla and all of the files in subdirectories have this "???" owner/group permision:

-????????? ? ? ? ?            ? file_a.txt
-????????? ? ? ? ?            ? file_b.txt
-????????? ? ? ? ?            ? file_c.txt

This is when viewed from "user_a" but when viewed as root then are correctly identified at "user_a:user_a". I tried to chown -R <owner>:<group> path/ but permissions still look correct as root and still look like "???" on "user_a".

I tried copying the folder and fixing the permissions but it's still messed up. How can I fix this?

Zhro
  • 2,669

1 Answers1

2

You didn't show the permissions of the directory containing those files, but it's likely you're missing the access (x) bit from the directory permissions. Without it, you can't call stat() on files, and thus can't find out their sizes, permissions, owners, etc.

Example:

$ mkdir dir; touch dir/foo.txt; chmod -x dir; ls -l dir
ls: cannot access 'dir/foo.txt': Permission denied
total 0
-????????? ? ? ? ?            ? foo.txt

Make sure you have the x bit set on the directories. You could add it for the owner for all directories in the subtree with something like this:

find . -type d -exec chmod u+x {} +

See: Execute vs Read bit. How do directory permissions in Linux work?

ilkkachu
  • 138,973
  • You're right that this ended up being as simple as a +x permission on directories. – Zhro Sep 18 '19 at 12:50
  • See https://unix.stackexchange.com/a/393603/132913 and https://unix.stackexchange.com/q/675364/132913 for handling directories – XavierStuvw Nov 01 '21 at 07:49
  • @XavierStuvw, um, yes, those are the same answer. Have only read r permission, need access(execute) x too. – ilkkachu Nov 01 '21 at 08:39