Linux learning notes (1)

xiaoxiao2021-03-06  67

First part shell

Chapter 1 file security and authority

1.1 file

When you create a file, the system saves information about the file, including:

File location

file type

File length

Which users have this file, which users can access the file

i node

Document modification time

File permission bit

1.2 file type

d catalog

l Symbol link (pointing to another)

S socket file

B block device file

C character device file

p Named pipe file

- ordinary document

1.3 permission

In addition to the front "-", a total of 9 characters, respectively correspond to 9 rights, respectively, can be divided into 3 groups.

R Read Permissions W Write / Change Permissions x Permission to execute this script or program

The first group defines the file genus

The second group defines the file owner's default group permissions

The third group defines the permissions of other users in the system

1.4 change power limit

CHMOD changes the permission bit of the file, there is absolute mode and symbol mode.

1.4.1 symbol mode

The general format of the chmod command is:

Chmod [Who] Operator [Permission] FileName

The meaning of WHO is:

u Document host

G in the same group user permissions

o Other user rights

a all user rights

The meaning of Operator is:

Increase permissions

- Cancel permissions

= Set permissions

The meaning of Permission:

R read rights

W Write Permissions

X execution permission

S file owner and group set-id

T viscous position

L Plus the file to make other users can't access

U, G, O for file owners, the same group users and other users

1.4.2 CHMOD command example

Assuming that the file MyFile file has this permission: RWX RWX RWX:

CHMOD A-X myfile Reclaims All User Execution Permissions

1.4.3 absolute mode

The general form of the chmod command absolute mode is: chmod [mode] file where MODE is an octave.

In absolute mode, each permission bit is indicated by an eight-input number.

0400 file owner can read 0010 The same group can be executed

0200 file owner can write 0004 Other users to read

0100 file owner can execute 0002 other users can write

0040 Group User Readable 0001 Other Users Executive

0020 The same group can write

When setting the permission, simply use the number of permissions corresponding to it, add it, it is the corresponding permission bit.

1.5 directory

The permission bit of the directory is different. The permission bit of the file is different. The read rights of the directory means that the contents can be listed. Write permissions mean that files can be created in this directory, and the execution rights limit means searching and accessing the directory. The permissions of the directory will overwrite the permissions of files in the directory.

转载请注明原文地址:https://www.9cbs.com/read-88757.html

New Post(0)