CHMOD ------ some common sense to get started
Directive Name: CHMOD Usage Permissions: All users
How to use: chmod [-cfvr] [--help] [--version] mode file ...
Description: Linux / UNIX file access rights are divided into three levels: file owners, groups, others. Using CHMOD how to control the file is accessed by others.
Tie count:
Mode: Permissions Set strings, formats are as follows: [Ugoa ...] [[ - =] [RWXX] ...] [, ...], where u indicates the owner of the file, G represents The owner of the file belongs to the same group (group), o represents the other people, and a means that these are all. Represents increased permissions, indicates cancellation, = indicates unique setting permissions. R indicates that readable, W represents written, x represents executable, X represents only when the file is a subdirectory or the file has been set to be executed. -c: If this file authority does have changed, it is displayed in the change action -f: If this file authority cannot be changed, do not display the error message-V: Display permission change - R: All files in current directory Permissions change with the subdirectory (that is, changed by one by one) - HELP: Display Auxiliary Description --Version: Display version
Example: Set the file file1.txt to all people can read: chmod ugo r file1.txt
Setting the file file1.txt to be read: chmod a r file1.txt
Set the file file1.txt and file2.txt to this file owner, with its own same group of groups, but other people cannot write: Chmod Ug W, O-W File1.txt file2.txt
Set an ex1.py to only the file owner can be executed: chmod u x ex1.py
Set all the files and subdirectories in the current directory to anyone read: chmod -r a r *
In addition, CHMOD can also use numbers to indicate rights such as CHMOD 777 File syntax: chmod abc file
Where A, B, C are each number, which represents USER, Group, and Other permissions.
R = 4, w = 2, x = 1 To RWX attribute 4 2 1 = 7; to RW-attribute 4 2 = 6; if the R-X property is 4 1 = 7.
Example: chmod a = rwx file
CHMOD 777 File
Effects the same chmod ug = rwx, o = x file
CHMOD 771 FILE
Effect
If you use CHMOD 4755 filename to make this program with root permission command name: chown use permission: root
How to use: chmod [-cfhvr] [--help] [--version] user [: group] file ...
Description: Linux / UNIX is multi-person multi-work industry, all of which have owners. Use Chown to change the owners of the file. In general, this instruction only is used by the system administrator (root), and the general user has no permissions to change someone else's file owner, and there is no permission to change the owner of its own files to others. Only the system administrator (root) has such permissions.
Tie count:
User: New Archive owner's user IDGroup: New Archive owner's User Group (Group) -c: If the file owner does have changed, the change action is displayed - F: If the owner cannot Do not display the error message - H: only for links (LINK), not the LINK, true pointing file -V: Display owner change - R: All files and subdirectories in current directory Perform the same owner change (ie, changed one by one by one) - Help: Display auxiliary instructions --Version: Display version example: Set the owner of the file file1.txt User Jessie: Chown Jessie : Users file1.txt
Users of all files in the current directory with the owner of the subdirectory Lamport: chmod -r Lamport: users * -rw ------- (600) - only the owner has reading and writing Permission.
-rw-r - r - (644) - Only the owner has read and write permissions; and the group users and other users only have read privileges.
-rwx ------ (700) - Only the owner has read, write, execute permission.
-RWXR-XR-X (755) - the owner has read, write, execute permission; and group users and other users only have read, execute permissions.
-rwx - x - x (711) - The owner has read, write, execute permissions; and the group users and other users only have permission.
-rw-rw-rw- (666) - all users have file read, write permissions. This approach is not advisable.
-RWXRWXRWX (777) - All users have read, write, execute permissions. More unsuitable practices.
The following is two normal settings to the directory:
Drwx ------ (700) - Only the owner can read in the directory, write.
DRWXR-XR-X (755) - All users can read this directory, but only the owner can change the content in the directory.