.

Changing Ownership with chown and Permissions with chmod

Command chown will reassign the ownership of a directory:

Command chmod will reassign the permissions on a directory. You can express the options either numerically or in terms of patterns formed from r, w and x.

Chmod via patterns: Make patterns from u for user/owner, g for group and o for others (i.e. neither the owner of members of the group). Couple these with any or all of r for read, w for write and x for executable. For example you can set u=r, u=rw or u=rwx and so on. You can set an additional bit on a directory, the restricted deletion bit, denoted t, whereby only the owner (or root) can delete an included file or directory. There are many combinations of options. I will list some common ones to exemplify the usage:

Chmod via numbers: This method is more elegant but perhaps harder to remember. Here's the template:

400 read by owner
040 read by group
004 read by anybody (other)
200 write by owner
020 write by group
002 write by anybody
100 execute by owner
010 execute by group
001 execute by anybody

Calculate the number to use in chmod by adding the numbers from all the filled locations, using the table to the left or the graphic below.

graphic png is missing

Here are the examples I gave above, recast into the numerical format:

Footnote for the advanced:

1000 sticky / restricted delete
2000 set gid on execution
4000 set uid on execution