File permissions

From XPUB & Lens-Based wiki

See also the page on ACL.

change ownership

$ chown -R USERNAME:GROUPNAME foldername

change rwx permissions

$ chmod -R rwx+ugo foldername
r = read
w = write
x = execute
u = user
g = group
o = others
drwxrwxrwx
 u  g  o
d = directory

Using find to recursively set file permissions, folders vs. files

   find . -type d

to "dry run" (only echo):

   find . -type d -exec echo folder: {} \;

this is actually calling chmod

   find . -type d -exec chmod 755 {} \;

and for files:

   find . -type f -exec chmod 644 {} \;