Ubuntu – Directory with readable and unreadable files

chmodpermissions

I am root. I want to make a directory, SuperSensitiveDirectory, private so that only root can even read the files inside it and its sub-directories. There are passwords in these files, and they should not be visible to any users besides root.
There are two log files in a sub-directory of my SuperSensitiveDirectory, though, that I want to be visible (though not writable) to everyone.

Ideally, I'd make SuperSensitiveDirectory private and add some kind of exception for the log files. How can I do this?

If if can't be done, is there a way to recursively change all the files in SuperSensitiveDirectory to 700 permissions? If I did that, I could then individually change the permissions for the log files.

Best Answer

If you make your directory permission to 700 by

$ chmod -R 700 foo

and even if you do 777 to any other file inside it, then any other user cannot access the directory contents. So ultimately making the files inside it unreadable.

To resolve that you can create symbolic links of your log files in a directory with public read permissions, and also give read permissions to the links also.