0

I've added a user (test) to the group www-data with the following command:

sudo usermod -a -G www-data test

When I try to view a directory with permissions 744, it says Server returned empty listing for directory (lack of permission).

What am I doing wrong?

1 Answer 1

1

Your permissions are incorrect. A directory without the execute bit is not traversable, so, in effect, nothing in it is accessible. While ls will be able to list the files, other programs like FTP and SFTP will fail. Set the execute bit:

chmod g+x /path/to/directory
3
  • Is it dangerous to allow the group to execute in the directory?
    – user321524
    Oct 4, 2014 at 18:30
  • 1
    @user321524 The execute permission on a directory does not automatically grant execute permissions on files within that directory (unless you run chmod with -R, which is a bad idea). But if you want users in that group to access files within, you will have to set the execute bit on the directory. Whether those users accessing it is dangerous or not is up to you.
    – muru
    Oct 4, 2014 at 18:31
  • Permissions on directories and files doesn't work in the same way, but in one way it does. But if you knows and think of a directory as a special file with lists of the names of other files in the directory, it may be easier to think about it and how it works (except for the x rights). The r gives you the right to read the contents of the directory-file, that is a list of the contents of the directory. With w rights you can change the contents of the directory-file, which makes it possible to add, remove and rename files.
    – Anders
    Oct 5, 2014 at 19:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.