Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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


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.

share|improve this question

migrated from stackoverflow.com Oct 3 '13 at 15:14

This question came from our site for professional and enthusiast programmers.

chmod +r -R /your/path should make it. What error do you get? –  fedorqui Oct 3 '13 at 12:52

3 Answers 3

up vote 3 down vote accepted

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!

share|improve this answer
Sorry, i think my explanation is not so clear. I want to add read permissions for the folders /admin, KNUCKLES and dbs not all the folders inside dbs. –  Jorge Vega Sánchez Oct 4 '13 at 14:49
@JorgeVegaSánchez See the edit above. –  devnull Oct 5 '13 at 6:25
Great answer. Thanks. –  Jorge Vega Sánchez Oct 6 '13 at 9:35

You'll have to split it up and issue multiple commands.

chmod -R xx4 /home/
chmod -R xx4 /home/mDB/
chmod -R xx4 /home/mDB/admin/
chmod -R xx4 /home/mDB/admin/KNUCKLES/
chmod -R xx4 /home/mDB/admin/KNUCKLES/dbs/

Someone with more advanced command-line-fu than me may know a shorter way.

share|improve this answer
Ok, there is no only a command to do that task. Thanks for your answer. –  Jorge Vega Sánchez Oct 4 '13 at 14:45

Or alternatively you might use find:

find /home/mDB/admin/KNUCKLES/dbs/ -type d -exec chmod o+r {} \;

which has the advantage of being much more flexible, i.e., it is capable of performing more complex operations than the one in question, should you wish to do so.

As a matter of fact, find used to be, for a long time, the only command capable of descending a directory tree and performing operations upon the selected objects. It has been only relatively recently that more and more commands (rm, chown, chmod) have acquired the capability of descending a directory tree via the -R option. But find still remains the weapon of choice, at least for anything even slightly complicated.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.