Is it possible to make a directory that a user cannot list, but would be able to access files in it?
Solution 1:
Yes indeed. You can see the contents of the directory if the read r
permission is set. You can traverse a directory and retrieve a file from it if the x
permission is set.
Examples where that may be necessary? Any time you want to give users access to a specific folder, but do not want they can inspect the contents of the parent directories. For example, if you do not want that users can see the name of the home directory of other users in /hom
, then you could turn off the r
bit of /home
for "others".
It is never "necessary". It is always the administrator that balances security needs and implements them. There can only be recommendations here, and these will depend on each individual use case.