Things I can’t remember – Permissions

We recently migrated our sites to Linode. Since we switched distros from Gentoo to Ubuntu we had to add the users in by hand. That meant that the permissions on the old system didn’t match the permissions on the new system. In most cases, I want the person who owns the site to be the owner of the files and the group for the site be able to read and write the files. I usually put myself, artists, and system maintainers into the group. Everyone else, including Apache, gets read access. To do this manually is a real pain. Fortunately, there is an easy way.

To change the permissions on the directories go to the site you want to change and use:


sudo find . -type d -exec chmod 775 {} \;

To change the permissions on the files go to the site you want to change and use:


sudo find . -type f -exec chmod 664 {} \;

You need sudo since you probably aren’t the owner of the files. That’s it. The commands work recursively from wherever they are started.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.