Linux – Add read permissions to all the directories of a path

bashchmodfile-permissionslinux

I want to add (not modify other file permissions) for all the directories in the path written bellow. Something like chmod -R xx4 /home/mDB/admin/KNUCKLES/dbs/

The path

/home/mDB/admin/KNUCKLES/dbs/

I try with this command i found in a forum but doesn't work for me.

chmod +r /home/mDB/admin/KNUCKLES/dbs/ -R

I only want to change the permissions for all the users not for the file/directory owner or the groups.

Thanks in advance.

Best Answer

You can say:

chmod -R o+r /home/mDB/admin/KNUCKLES/dbs/

This would give read permission recursively to others, i.e. not owner/group.

EDIT: As per your comment, it seems that permissions for directories is the issue and not that of files. You could say:

chmod o+rx /home/mDB/{admin,admin/KNUCKLES,admin/KNUCKLES/dbs}

Note that since these are directories, you need to set the execute x bit on. Without that, r would serve no purpose!

Related Question