Different rights for files and dirs

This is one snippet that I sometimes need, but always forget how it looks like:

  • to change directory rights:

find . -type d -exec chmod 740 “{}” \;

  • to change file rights:

find . -type f -exec chmod 640 “{}” \;

Obviously I do not need it often enough (or I would rembember it and this posting would not have happened), or I am a linux noob – I am not sure yet.

At least, now I know where to copy and paste from next time.

Leave a Reply

Your email address will not be published. Required fields are marked *