When I create new folder, it has chmod 755. I want 777

October 27, 2015 911 views
Apache Linux Basics

How can I set default chmod for new files or folders to 777? I don't want to run chmod -R 777 everytime the file is created. Any ideas? Thanks

1 Answer


In order to set a folder to grant default permissions to subfolders, you will need to do the following:

chmod g+s <directory>

This sets the group ID for the directory. Then, you can set your group to rwx by default with this command:

setfacl -d -m g::rwx /<directory>

Finally, to set all other users with the same permissions of rwx (which is a less secure setting):

setfacl -d -m o::rwx /<directory>

After running those commands, check permissions with

ls -al /<directory>

  • Is it possible it had made something so my PHP scripts started yelling "Unable to acquire lock on <file>" when trying to reach cache files?

    • It is definitely possible - especially if your PHP code is expecting ownership from a certain group/user, or different file permissions than 777.

Have another answer? Share your knowledge.