Folder permission

Hi,
Newbie hear!.

can any one please let me know if it is possible to have create folder permission without write permission to a parent directory in linux?

~Jay

Not 100% sure what you’re asking…

If you’re asking if it’s possible to have a directory WITHOUT write permissions (by a particular users/groups), but have a subdirectory WITH write permissions … yes.

Try it

mkdir ~/test-parent
mkdir ~/test-parent/test-child
chmod 555 ~/test-parent

Now see if you can create a file or folder in ~/test-parent and ~/test-parent/test-child

Or am I misunderstanding the question ?


You can delete these test folders (and contents) when you’re done testing with:

sudo rm -r ~/test-parent

Thanks Mark. Below is what i was trying to see if it is possible.

Parent folder: ~/test-parent

I don’t want anyone to write to the parent folder, but they can create subfolders and write to those subfolders under test-parent. Please let me know if it is possible in anyways.

~Jay

Well I can’t see how they could CREATE subdirectories if they’re not allowed to write to the parent directory … because creating directories requires write permission.

Thanks Mark. In other words, can only mkdir command is allowed to execute in Parent folder:(~/test-parent) and restrict all other commands just for parent folder?

Sorry I’m having difficulty understanding what you’'re asking.

Mark,

Below is what I want to check.

Parent folder: ~/test-parent (allow only mkdir command in this folder)
child folder: |_ child-folder-under-parent (allow write and other commands in this folder)

Please let me know if the above setup is possible.

~Jay

No, you could only use mkdir in the parent folder if you had elevated privileges (sudo mkdir).

There’s no way (that I know of) to allow writing of folders but not files … you either have write permission or you don’t.