I am always used to CHMOD and confuse chown.
Chown modifies the content of the first column, and chmod modifies the content of column 3 and 4.
Chown usage
Used to change the user name and user group of a directory or file
Chown User name: the path of the group name file (which can be a pair of paths or a relative path)
Example 1: chown root: Root/tmp/tmp1
Change the user name and user group of tmp1 under TMP to root and root (only the group of tmp1 is modified ).
Example 2: chown-r root: Root/tmp/tmp1
The group of all objects in tmp1 under TMP is changed to root and root.
Chmod usage
Used to modify the access permissions of a directory or file.
Syntax: chmod [who] [+ |-| =] [mode] File Name
The meaning of each option in the command is:
The operator who is one of the following letters or their combination:
U indicates "user", that is, the owner of a file or directory.
G indicates "group users", that is, all users with the same group ID as the file owner.
O indicates "Other (Others) Users ".
A Indicates "All (all) Users ". It is the default value of the system.
The operation symbol can be:
+ Add a permission.
-Cancel a permission.
= Grant the given permission and cancel all other permissions (if any ).
Set the permissions indicated by mode to any combination of the following letters:
R readable.
W writable.
X executable.
X adds the X attribute only when the target file is executable to some users or the target file is a directory.
S sets the owner or group ID of the process to the file owner during file execution.
In the format of "U + S" to set the user ID of the file, and "G + S" to set the group ID.
T save the program text to the swap device.
U has the same permissions as the file owner.
G. users in the same group have the same permissions as file owners.
O has the same permissions as other users.
File Name: list of files separated by spaces to change permissions. Wildcards are supported.
Reference: http://hi.baidu.com/whn_arthur/item/6ce34137321e2385b711db27