Wednesday, April 23, 2008

File Permissions and Ownership

0=none
1=execute
2=write
4=read
1+2=3=write+execute
1+4=5=read+execute
2+4=6=write+read
1+2+4=7=read+write+execute

0765
7=read+write+execute for USER
6=read+write for GROUP
5=read+execute for OTHERS

to change permission for a directory called "example", all sub-directories and all files in those directories
chmod -R 0777 example

to change ownership of a directory called "example", all sub-directories and all files in those directories to user "spiderman" and group "superheroes"
chown -R spiderman:superheroes example