Home >System Tutorial >LINUX >Linux file permissions Speaking of permissions, Linux file calling permissions are divided into three types of permissions

Linux file permissions Speaking of permissions, Linux file calling permissions are divided into three types of permissions

WBOY
WBOYOriginal
2024-06-01 17:34:33553browse

1. Linux file permissions

Speaking of permissions, Linux file calling permissions are divided into three types of permissions for all objects: user, group user's group, and other people. Each object has three permissions: r: read, w: write, x: execute. Madmen like to use numbers to represent them, such as: rwx is the two's complement 111, which is the ten's complement 7. For example, we view the information of all files in the current directory ls-l:

1. The first digit in circle 1 indicates the type of the file, - indicates an ordinary file, d indicates a directory, and l indicates a link; the next nine digits can be divided into three groups of rwx, each group corresponding to all objects with each permission, This means that user has rwx read, write and execute permissions, group has r-x read and execute permissions, and other has r-x read and execute permissions

2. The ten’s complement number 3 means it has been cited three times

3. The first root indicates that the file owner is the super administrator root, and the second indicates that the group it belongs to is the root group

4. File size (unit: Byte), if you want to display kb or Mb units, ls-lh

查看文件权限linux_linux 查看文件的权限_linux文件权限查看命令

5.The last time this file was changed

6.File name

2. umask and chmod

linux文件权限查看命令_查看文件权限linux_linux 查看文件的权限

1.umask: Determine the permissions when the file is built. For newly created files, the system does not allow it to have execution permissions when it is complete, that is, the maximum permissions are 666 (rw-rw-rw-); for newly created directories, the maximum permissions are 777 (rwxrwxrwx)

1.umask: Determine the permissions when the file is built. For newly created files, the system does not allow it to have execution permissions when it is complete linux permissions to view files, that is, the maximum permissions are 666 (rw-rw-rw-); for newly created directories Say, the maximum permission is 777 (rwxrwxrwx)

I want to check the default permissions of the currently created files: umask, what I see here is 0022 [the first 0 represents special permissions regardless of him] linux View file permissions , the permissions of the created file are 666 -022=644 is rw-r–r--, and the permissions of the created directory are 777-022=755 which is rwxr-xr-x. (Note: Since creating files does not allow x permissions, the position of the three-digit ten's complement prime number obtained after estimating the umask must be added by 1. For example, setting the umask to 031 command: umask0031, the permissions of the created file are 666-031=635, 635 +011=646i.e. rw-r–rw-)

在这里插入图片描述

umask0031Create directory permissions are 777-031=746 which is rwxr–rw-

[Note] This can only temporarily modify the umask value. Linux common commands. If you want to make permanent changes, you need to modify the configuration file. If you are crazy, don’t do it yourself. Baidu

2.chmod: Modify the permissions of existing files. For example, when a was created just now, the permissions were 644. After executing the command: chmod777a and later the linux format command, the permissions of a were changed to 777, which is rwxrwxrwx

在这里插入图片描述

The above is the detailed content of Linux file permissions Speaking of permissions, Linux file calling permissions are divided into three types of permissions. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn