Zoomba
Zoomba

Reputation: 1806

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.

Upvotes: 1

Views: 1853

Answers (1)

Leonardo Alves Machado
Leonardo Alves Machado

Reputation: 2837

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).

Upvotes: 1

Related Questions