CHOWN & CHMOD - R
CHOWN
chown -R user:mail ./* ./.[!.]*
CHMOD
-#to remove executable permissions
chmod -R 600 /path
-# to make directories transversal
chmod -R u=rwX,g=,o= /path
Above. for the user owner i'm giving capital "X", so it does apply only to directories and not files
-# all files in the current directory, recursively, including hidden files
chmod 755 -R ./* ./.[!.]*
-#all files in the current directory, not recursively, including hidden files
chmod 755 ./* ./.[!.]*
Notes: This will not change an exception filename starting with 2 dots, as example,
./..weirdfilenamehere.txt
Also, be careful not to remove the x
bit, or else all your directories will not be accessible (one needs the x
bit to cd
into a directory).
Remember this: never use bare *
but ./*
instead.
To avoid problems setting permissions on directories, use find instead.
find . -type f -exec chmod
VALUE{} \;
ACL (Access Control Level)
-# To apply the ACL
setfacl -Rm u::rwX,g::0,o::0 /path
-# To make the applied ACL default policy so newly created files will inherit the desired permissions.
setfacl -Rm d:u::rwX,g::0,o::0 /path
Again using capital X
so it applies only to directories and not files.
CHOWN - Stackoverflow Forum || CHMOD & ACL - SuperUser Forum