obda.net

Default File Permissions for a Directory

Add a comment

cheat-sheet articles are about code snippets that I need every once in a while, and which I constantly forget about.

You can set the default permissions for all files created in a given directory using POSIX access control lists (ACLs). For example, after executing

user@host:~$ setfacl -d -m u::rwx,g::rwx,o::r-x ~/path/to/example/dir

all new files (and directories, too) in ~/path/to/example/dir will have group write permission enabled. To check the currently effective ACLs, use getfacl.