Red Flag asianux Server 3 System Management: command-line Operations (iii)

Source: Internet
Author: User
Keywords Asianux command-line operation
Tags *.h file access access rights change command-line operation control created creator

1.4 File Permission Actions

In a multiuser operating system, for security reasons, each file and directory is required to have access rights, and the permissions of each user are strictly defined. At the same time, users can give their own files the appropriate permissions to ensure that others can not modify and access.

1.4.1 Change File Master

Linux assigns a file owner to each file, called the file Master, and the control of the file depends on the file master or Superuser (root). The creator of the file or directory has special rights to the files or directories created. All relationships of a file can be changed, and the Chown command is used to change the ownership of a file or directory. The syntax format for the Chown command is:

chown [Options] User or group file 1 [File 2 ...]

The user can be a user name or a user ID. The file is a space-separated list of files for which you want to change permissions, and you can use wildcard characters to represent file names. If you change the ownership of a file or directory, the original file will no longer have permission to the file or directory. Http://www.aliyun.com/zixun/aggregation/13879.html "> The system administrator often uses the Chown command to give the user permission to use the file after copying it to another user's directory.

1.4.2 Change user Group

Under Linux, each file belongs to a user group at the same time. When you create a file or directory, the system gives it a user group relationship that all members of the user group can use. The flag for a file user group relationship is a GID. A file's GID can only be modified by the file master or Superuser (root). The CHGRP command can change the GID of a file in the form of:

CHGRP [option] group filename

Where group is the user group ID. The file name is separated by a space. To change the list of files in a group, it supports wildcards.

1.4.3 File Permission settings

Each file and directory in a Linux system has access permission to determine who can access and manipulate files and directories in any way.

Access rights specify three different types of users:

File Master (owner)

Same groups of users (group)

Other users who can access the system (others)

Access rights specify three ways to access a file or directory:

Read (R)

Write (W)

Executable or find (x)

When you display the details of a file or directory with the LS command or the l command, the leftmost column is the file's access rights. The meanings are as follows:

File access rights

Read permission (R): Allows only the specified user to read its contents, and disallow any changes to it. You need read access to the contents of the file you are accessing as an input command. For example: Cat, more and so on.

Write Permission (W): Allows the specified user to open and modify the file. For example, the command VI, CP and so on.

Execute permission (x): Specifies that the user executes the file as a program.

Directory Access Permissions

Read permissions (R): You can list the files stored in the directory, that is, the list of content that is read. This permission allows the shell to list matching file names using file name extension characters.

Write Permission (W): Allows you to delete or add new files from the directory, usually only the directory owner has write permissions.

Execute permission (x): Allows you to find in the directory and can use the CD command to change the working directory to that directory.

Related Article

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.