Edit folder permission for folder and subfolder with Linux CLI

38 Views Asked by At

Hardly use Linux and for some reason, I can't find a working solution.

Following situation:

Example: I have Folder_01 under /var/tmp/ Inside Folder_01 is Folder_02

How can I archive it? Folder_02 gets the same Security Permissions (Read, write, full) as Folder_01 has right at the moment.

When I change the permissions on Folder_01, Folder_02 isn't affected by this with for example:
*chmod u=rwx,g=rwx,o=rwx ./Folder_01/*
(I know, bad security example)

So what should the command look like, so that there is an inheritance?

Tried the code above and did a bit of research on Google but it didn't work out for me.

1

There are 1 best solutions below

2
Romeo Ninov On

You can try sopmething like:

find  /var/tmp/Folder_01 -type d -exec chmod u=rwx,g=rwx,o=rwx '{}' \;

This command may have problems when in the path you have name of directory with special characters inside.