Linux Development file and folder permissions knowledge points

Source: Internet
Author: User

My little brother just went from under the development of Windows to Linux under development, hereby record the process of learning, is a memo

chmod assigning permissions to files and folders

CHMOD ABC Filea,b,c represents User,group,other's permissions respectively. One is the chmod post-add number, followed by the file name r = 4 W = 2 x = 1
The other is the chmod after the letter, followed by the file name

U: The user who owns the file (owner);

G: The group where the owner resides;

O: Other persons (not owners or owners of the group);

A: Everyone or all (U, G, and O).

The types of file access that users have are as follows:

R: Read right;

W: Write Right;

X: Executive Right.

There are several types of file permission configuration behavior:

+: Add permissions;

-: Delete permissions;

=: Make it a unique permission.

To view the permissions for a Linux file: Ls-l file name View permissions for Linux folders: Ls-ld folder name (in the same directory)
Rwx the previous character corresponds to the file type:-is the normal file, D is the directory (dir), c means the character device (in Linux/unix, all the devices are files), B is the block device file, S is the socket file, and so on. \

First, the significance of the permissions for the directory

1, the first thing to understand is that the main content of the directory is to record the list of file names and sub-directories, rather than the place where the data is actually stored.

2. R permissions: Having this permission means that the list of directory structures can be read, that is, you can view the file name and subdirectory name under the directory, note : only the name.

3, W permissions: Having this permission means having permission to change the directory structure list, in short, the W permission of the directory is related to the change of the file name or subdirectory name in the directory, note : Refers to the name. Specific as follows:

1) Create a new file or subdirectory under this directory.

2) Delete a file or subdirectory that already exists in the directory (regardless of the permissions for that file or subdirectory), note : It is important that the user can delete a file or directory to see if the user has the W permission to the directory where the file or directory resides.

3) Rename the file or subdirectory that already exists in the directory.

4) Transfer the location of the files or subdirectories within the directory.

4, x permissions: The x permission to have a directory indicates that the user can enter the directory into a working directory, can enter a directory, only with the directory's X permission, if the user does not have x permission for a directory, you cannot switch to the directory, you cannot execute any command under that directory, even if the directory has R permissions. And if the user does not have X permission on a directory, the user cannot query the contents of the file under that directory, note : Refers to the content, if you have R permission to view the list of file names or subdirectories in the directory. So to open the directory to anyone browsing, should at least give R and X permission.

Second, the significance of the permissions for the file

1, it should also be understood that the file is actually contained in the data, so R, W, x permissions on the file is related to its content.

2. R permissions: For this permission, the actual contents of this file can be read.

3, W permissions: Having this permission means that you can edit, add, or modify the contents of the file. However, the deletion of the file is not included because the above permission is for the purpose of the directory to know what the conditions for deleting the file or directory are.

4, x Permission: Indicates that the file has permissions that can be executed by the system. Whether a file can be executed is determined by that permission, and does not have an absolute relationship with the file name.
In the source code project, want a file readable and writable, but do not enforce the requirements, you can try this star chmod 666 folder

Linux Development file and folder permissions knowledge points

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.