Search code examples
linuxadminchmodrights

Unknown users rights (-????????? ? ? ? ? ? myFile.php)


I have some weirds user rights on my files.

Log as user1, I have set user2 owner of the files. It did worked.

       -rw-r-xr-x 1 user2 user2 21090 Jun 18 16:28 myFile.php
       drw-r-xr-x 2 user2 user2  4096 Jun 18 16:30 font

But then, when I log with user2 I Have this weirds unknown rights.

       -????????? ? ? ? ?              ? myFile.php
       d????????? ? ? ? ?              ? font/

Solution

  • Top directory that contains these files has no "x" bit set.

    chmod u=rwx test2/; ls -l test2
    total 4
    drwxr-xr-x 2 user group 4096 Jun 19 14:43 dir
    -rw-r--r-- 1 user group    0 Jun 19 14:43 file
    
    chmod u=rw test2/; ls -l test2
    ls: cannot access test2/file: Permission denied
    ls: cannot access test2/dir: Permission denied
    total 0
    d????????? ? ? ? ?            ? dir
    -????????? ? ? ? ?            ? file
    

    To fix this, please add "x" bit to following section of root directory. Usually "group" part is relevant but it might be "others" or "user" depending on your situation.

    chmod g+x /path/to/directory
    

    For further reading please consult http://www.linux.com/learn/tutorials/309527-understanding-linux-file-permissions