Chmod only files or chmod only folders

I moved the blog the a new server and i realised that all the permissions got screwed up on the process. All files and folders were having chmod 777, and that’s not exactly ideal. After digging a bit on google on how to chmod only files or chmod only folders, i came up with this:

1. Recursive chmod only files within this folder:
find . -type f -exec chmod 0600 {} ;

2. Recursive chmod only folders within this folder:
find . -type d -exec chmod 0755 {} ;

Hope this helps!

2 thoughts on “Chmod only files or chmod only folders”

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>