Permissions for Linux directories and users

Source: Internet
Author: User

Permissions for directories and users

First, Linuxfile permissions in the system1.1 Linuxthree basic permissions in the system

• Definition of file permissions: Access control for a file or directory (Access restrictions)

• Three attributes of a file:

Owner of the User (master): When the user creates a file, the default user is the master of the file.

User group owner (group): The user's primary group is the group of this file

L Others: not the above two.

For example:

# LL

Total 0

-rw-r--r-- 1 root root 0 Jul 8 18:28 text.txt

Where the third and fourth columns are the user's owner and owner group

• Three basic types of permissions:

L each file or directory has 9 basic privilege bits:rw-r--r-

L Three basic permissions : R(read)w(write)x(execute)

• Meaning of Read and write execution:



The meaning of the file

The meaning of the directory

R

Read

can view reading

List of files in a directory can be listed

W

Write

The files can be modified and deleted

Create and delete files in the directory

X

Perform

Files can be run (binary, script)

You can use the CD command to enter the directory

• Three levels of access:

The permissions of the file are represented by 9 characters, with 1 groups per 3 characters


L First Group: Main (red):rwx

L Group II: Genus Group (blue):r-x

L Third Group: Other people (green):r-x

• The order in which Linux system permissions execute when a user accesses a file or directory:

(1) Access to the file or directory, the visitor is the owner? If yes, enable Master permissions, if not, perform the next

(2) is the user a member of the group? If you are a member of this group, enable group-owned permissions, and if not, perform the next

(3) If neither of the above is true, enable other people's permissions

Note: Three access levels are not passed and access to this file will be denied

1.2 Octal notation

A method that uses rwx to represent permissions, called mnemonics, and can also be represented with octal numbers

R(4),w(2),x(1).

1.3 Allocation of three basic permissions

Superuser (root) has all the privileges on the operating system and does not specify Superuser permissions on files or directories.

Permission bits

Meaning

is a sovereign limit

Used to restrict the creator of a file or directory

Group Permission Bit

Used to restrict the members of a group to which a file or directory belongs

Permissions for other users

Used to restrict access to the file or directory to other people who are neither the owner nor the group

1.4 Viewing permissions for files and directories

• View file or directory permissions

Use ll to view

Cases:

# LL

Total 0

-rw-r--r-- 1 root root 0 Jul 8 18:28 text.txt

First column (first character): The type of file, see -, represents the file, and if it is D, represents the directory

First column ( 9 other characters): Permissions for the file

Second column: Number of hard links

Column Three: Owner

Fourth column: Genus Group

Fifth column: Size of File

Column sixth: Time of creation, access and modification times

Seventh column: File name or directory name

• Mnemonic and octal correspondence

Character octal

rw-r--r--644

RW------600

Rwxr-xr-x 755

rwxr-r--744

rwxrw-r--764

Conversion method:

# R4 W2 X1

# Genus Master 3(and) genus 3(and) Others 3(and)= octal

Owner:4+2+0=6

Genus Group:4+0+0=4

Others:4+0+0=4


This article is from the "8469270" blog, please be sure to keep this source http://8479270.blog.51cto.com/8469270/1436513

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.