File types and permissions for Linux

Source: Internet
Author: User
Tags readable

information on using LL or ls-l to view files under Linux(ll and ls-l differences: LL will show hidden files in the current directory, and Ls-l will not)file information is divided into: file type, permissions, number of links, the user, the user group, file size, last modified time, file name, concrete can see.   I. File type:d: Folder-: Normal fileL: Links (Windows-like shortcuts)B: block device files (e.g. hard drives, optical drives, etc.)P: Pipeline fileC: Character device files (e.g. serial devices such as cats)s: Set of interface files/data interface files (e.g. a Mysql.sock file is generated when starting a MySQL server)  ii.. File Permissions
Permissions corresponding numbers Significance
R 4 Readable
W 2 can be written
X 1 Executable
-: Display when a location is empty--indicates that this permission is not availableThe permission bits consist of 9 bits, the first 3 bits represent the permissions of the file owner, the Middle 3 bits represent the permissions of the user group to which the file belongs, and the last 3 bits represent the permissions of the other user.  examples are as follows: Drwxr-xr-x 2 root mail 4096 January 03:44 accountindicates that the folder Account,root is his owner, has a readable writable executable permission; Mail is his own user group with readable, executable permissions, no writable permissions, other users have readable, executable permissions for this folder, and no writable permissions  Change Permissions command:chmod permission file nameThere are two uses of chmod1.chmod user + (-) permission file name
User Significance
U Owner (user)
G Owning Group (group)
O Others (Other)
A All of them (all)
(Increase permissions with +, reduce permissions with-, directly equal to the permissions with =) Example: Adding readable permissions to other users of the file Test.txtchmod o+r test.txt  Permissions Additional instructions:The file has default permissions:
Type Default Permissions
File rw-rw-rw-
Directory Rwxrwxrwx
but this permission is not necessarily the default permission for our Linux system, each system has a permission mask (unmask)Viewing the permission mask with a command (Umask viewing a number mask; umask-s viewing a character mask)Number Mask: Default mask minus the permission represented by the number maskcharacter Mask: The intersection of default flooding and character masks represents permissionscommand to modify the permission mask: umask 007 (or umask u=rw,g=rwx,o=r) 2.chmod Permissions numeric file nameThe permission number consists of 3 digits, the 1th digit represents the owner's permission, the 2nd digit represents the permission of the owning group, and the 3rd digit represents the other person's rights .Example: The Test.txt file change permission for the file owner can read the writable executable, the file belongs to the group can be read and writable executable; Other people can read executable is not writable. chmod 775 Test.txtDescription: Number is the value of the corresponding permission and. For example 7=4+2+1, so 7 represents a readable writable executable. 5=4+1, so 5 represents a readable executable that is not writable. 0 means unreadable, non-writable, non-executable  Iii. The owner of the document and the group to which it belongs1. Change the file ownercommand: Chown user name fileExample: Chown work test.txt (change the owner of the Test.txt to work) 2. Change the group to which the file belongscommand: CHGRP group name fileExample: Chgrp named Test (change the group of Test to named)  Other:1.chmod and Chgrp, chown have a parameter-R, you can recursively change the directory and its sub-directories with the permissions, etc.2. Some ll will find a "." After the first paragraph has been found. or "+" as shown in:looked it up on the internet,"." Represents a security label with SELinux, with security context properties (can be viewed with Ll-lz)"+" means that the file has security measures applied to other access controls(interested people can check their own, I did not go to query too much content.) )

File types and permissions for Linux

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.