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.

2 Answers 2


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.


it is possible to set their permissions to "only read/write as root" by opening nautilus or some other file manager and going to properties then permissions and set both owner and group as "root" then set permissions for owner as read/write, permissions for group as read/write and permissions for "everyone else" as "cannot access" or whatever your file manager calls it.

  • This is a bare-bones GUI-free server with no Internet access. It does not have and cannot get a file manager like you're describing.
    – Qaz
    Jun 27, 2014 at 19:18
  • 1
    it is completely possible to use chmod, just rename the files so they have a "." in front of them, to make them even more hidden and to differentiate them from the others when using chmod, then use chmod with -R and for the file name use ".*" leave the log files you do not want to change alone, don't rename them, then individually use chmod on them to make them read only
    – sbergeron
    Jun 27, 2014 at 19:23

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.