Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the command for Linux to modify file permissions

Shulou Source: shulou.com Published: 2022-06-01 20:40:29 09月19日 Update

This article mainly introduces "what is the command for Linux to modify file permissions". In daily operation, I believe that many people have doubts about what is the command for Linux to modify file permissions. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "what is the command for Linux to modify file permissions?" Next, please follow the editor to study!

Modify permissions you can use the chmod command to modify file permissions. For example:

Chmod 754 test4 stands for read permission, 2 for write permission, and 1 for execute permission

7 write 4 + 2 + 1, which means that you have read and write executable permission, 5 read 4 + 1, but no write permission 0 means no permission, and so on.

[root@localhost /] chmod 456test.txt / / means that root users have r (4) permissions on test, root team test files have r (4) + x (1) permissions, and others have rw permissions [root@localhost /] chmod 000000 test.txt / / means that excluding all permissions, why does "4", "2", "1" represent read and write execution permissions, rather than other numbers?

We know that the lowest coding of the computer is binary, that is, 0Jet 1. To represent the read and write execution permissions of a file, the underlying layer only needs one byte, that is, 8 bits.

It is agreed that the third bit from the right is 1, which means read permission; the second bit is 1, which means write permission; and the first bit is 1, which means executable permission. Is 0, there is no corresponding permission.

That is, binary to decimal, 0000 0100 = 4, 0000 0010 = 2, 0000 0001 = 1. That is, the corresponding binary bit is 1, that is, it has the corresponding authority. This is also the reason for the questions raised above, which makes it easier for people to remember the meaning of these numbers.

At this point, the study on "what is the command for Linux to modify file permissions" is over. I hope to be able to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Tags: Permissions representatives files commands learning binary numbers more help utility and so on and then decimal reason just need meaning bytes bottom place article Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Shulou Tech Info MySQL Apple vpn