linux-user groups, permissions

Source: Internet
Author: User

The Linux user group is divided into: owner, group, other group

    • Owner: Who created, who is the owner. Command: Ls-al
    • Group: When creating a file or folder, this file or folder is assigned to the user group, which effectively isolates the file.
    • Other groups: In contrast to the group, it is the other group

Linux file permissions: File properties, modify file properties, and permissions

    • File properties: The file attributes are 10 bits in total. In addition to the first, the remaining three-bit one-component three groups

First bit: attributes (-for files, D for directories, L for linked files, B-Interface devices, C-port devices)

First group: Permissions for the file owner.

Second group: Permissions for the same user group

Group Three: Permissions for other groups

Rights r =4 Readable, W =2 writable, x = 1 executable

    • Modify file properties

CHGRP: Change the user group that the file belongs to chgrp [user group name] File

Chown: Change the file owner Chown [account name] file or directory

chmod: Change the permissions of a file r=4,w=2,x=1

Or

A=all; U=user, G=group; O=other; + Add permissions;-turn off permissions; = Set permissions

For example: Modify the permissions to-rwx rw-r

Mode one: the first group rwx = 4+2+1=7; the second group rw-= 4+2+0=6; The third group r--: 4+0+0=4;

Command: chmod 764 FileName

Mode two; chmod u=rwx,g=rw,o=r FileName

For example, if you do not need to know the file permissions, you need to increase the file execution permissions or remove the execution permissions

chmod a+x FileName; chmod a-x FileName

Permission meanings for directories and files:

    • For file:
        • R = Read: reads the actual contents of the file.
        • w = write: Edits the actual contents of the file. The file cannot be deleted.
        • X =execute: Executes the file. The file cannot be deleted.
    • For directory:
          • R: The LS command can be used to read files in the directory.
          • W: You can change the list of directory structures.
            • Create a new file or directory
            • Delete files, directories
            • Renaming files or directories
            • Transferring files, directories

        • X: Whether the user has permission to enter the current directory for Work commands: CD to switch directories.

File, r= can access the file directory linked list of this file, can allow access to this file requires X permission.

x= switch, whether access to this directory is allowed. Whether the directory can be accessed via the CD command.

   

linux-user groups, permissions

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.