Question

Do we have a way to 'chmod' all leading directories in linux?

For example,

when the permission of 'flex' directory in the path '/local_home/my_home/flex/source' is set to 000,

chmod 755 /local_home/my_home/flex/source/ will fail due to the permission of 'flex' directory.

I want to change all permissions of directories presented in the second parameter of 'chmod' command.

Do we have the solution?

Thank you in advance.

Was it helpful?

Solution

You should use the chmod command as root user or as a sudoer (sudo chmod ...) otherwise it fails. If you use:

sudo chmod 755 /path/to/flex

the permission reflects only on the 'flex' directory. If you want to set the permission to all of his (flex) child files and directories you should use the '-R' option, which stands for recursively. In this case your command will like this:

sudo chmod -R 755 /path/to/flex
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top