A. Mashreghi A. Mashreghi - 1 year ago 164
Linux Question

File permission vs directory permission

In Linux, if I have a file that is writable (chmod 771) inside a directory that is not writable (chmod 551), will the file be writable if I access it through that directory?

I have tested it and writing is possible, but my guts tell me that it shouldn't be possible.

Answer Source

You might correct me if I'm wrong, but Linux folders can be considered as "files" in this case. I mean, the content of a folder are the files and sub-folders it contains - if you remove the write permission, you are forbidding people from adding/removing files basically (and changing folder properties).

The files inside that folder doesn't inherit the folder's properties. Since the list of files remains the same (which is actually the content of that "file"), you can change the content of each file (as long as you have permission to edit that file).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download