Detailed description of chmod parameters and usage -- file folder permission setting command

Source: Internet
Author: User

For details about chmod parameters and usage-command for setting file folder permissions: chmod [-cfvR] [-- help] [-- version] mode file... note: file access permissions for Linux/Unix are classified into three levels: file owner, group, and others. Chmod can be used to control how files are accessed by others. Calculate: mode: permission setting string in the following format: [ugoa...] [[+-=] [rwxX]...] [,...], u indicates the owner of the file, g indicates that the owner of the file belongs to the same group, o indicates that the owner of the file belongs to other people, and a indicates that all three are. + Adds a permission,-Indicates canceling the permission, and = indicates a unique permission. R indicates that the file can be read, w indicates that the file can be written, and x indicates that the file can be executed only when the file is a subdirectory or the file has been set to executable. -C: if the permission of the file has been changed, the change action is displayed.-f: if the permission of the file cannot be changed, do not display the error message-v: show Details of permission change-R: perform the same permission change on all files in the current directory and sub-directories (that is, change one by one in the way of delivery) -- help: show auxiliary instructions -- version: Show version example: Set the file file1.txt to everyone to read: chmod ugo + r file1.txt set the file file1.txt to everyone to read: chmod a + r file1.txt sets the archive file1.txt and file2.txt as the owner of the archive, which can be written to the same group to which the archive belongs, but cannot be written to other people: chmod ug + w, o-w file1.txt file2.txt: Set ex1.py to only the owner of the file. Run chmod u + x ex1.py to set all files and subdirectories in the current directory to readable by anyone. Take: chmod-R a + r *. In addition, chmod can also use numbers to indicate permissions. For example, the chmod 777 file Syntax is: chmod abc file, where a, B, and c are each a number, indicate the permissions of User, Group, and Other respectively. R = 4, w = 2, x = 1 if you want the rwx attribute, 4 + 2 + 1 = 7; if you want the rw-attribute, 4 + 2 = 6; if you want the r-x attribute, 4 + 1 = 7. Example: chmod a = rwx file and chmod 777 file have the same effect as chmod ug = rwx, o = x file and chmod 771 file have the same effect. If chmod 4755 filename is used, this program can have the root permission command name: chown permission: root usage: chmod [-cfhvR] [-- help] [-- version] user [: group] file... note: Linux/Unix is a multi-person, multi-job operating system. All archives have owners. Chown can be used to change the owner of an archive. Generally, this command is only used by the system administrator (root). Generally, users do not have the permission to change the owner of another user's archive or change their owner to another user. Only the system administrator (root) has such permissions. Calculation: user IDgroup of the new archive owner: user group of the new archive owner-c: If the archive owner has indeed changed, -f: If the archive owner cannot be changed, do not display the error message-h: Change the link only, rather than the file that the link actually points to-v: displays the details of the owner's change-R: change the owner of all files and sub-directories in the current directory in the same way (that is, change one by one in the way of delivery) -- help: display auxiliary instructions -- version: display version example: set the owner of the file file1.txt to user jessie: chown jessie: users file1.txt of the users Group. Set all files under the current directory and sub-directory owner to user lamport of the users Group: chmod-R lamport: users *-rw ------- (600 )-- Only the owner has read and write permissions. -Rw-r -- (644) -- only the owner has read and write permissions, while the owner and other users have only read permissions. -Rwx ------ (700) -- only the owner has read, write, and execution permissions. -Rwxr-xr-x (755)-the owner has the read, write, and execution permissions, while the owner and other users have only the read and execution permissions. -Rwx -- x (711) -- the owner has read, write, and execution permissions, while the owner and other users have only execution permissions. -Rw-(666) -- all users have the permission to read and write files. This approach is not advisable. -Rwxrwxrwx (777)-all users have read, write, and execute permissions. It is not advisable. The following are two common settings for a directory: drwx ------ (700)-only the owner can read and write data in the directory. Drwxr-xr-x (755)-All users can read this directory, but only the owner can change the suid in the directory to 4, for example, the result of "-rwsr-xr-xsgid" is "2". For example, the result of "4755" is "-rwsr-sr-xsticky", which indicates that the number is "1, for example, if the result of 7755 is-rwsr-sr-t

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.