Linux User Rights in the Linux operating system, root is the highest, the equivalent of Windows Administrator, with the highest privileges, can execute any command and operation, in the Linux system, By UID to distinguish the user's permission level, UID equals 0, indicating that this user has the highest privileges, that is, the administrator, the other user uid is incremented, by/etc/passwd user password file can view each user's independent Uidlinux file or directory user, group, other people permissions Each file or directory in Linux contains a user right, a group of permissions, and other people's permissions as shown below: Red The first root indicates that the file owner is the root user, The second root is the root group for the file, and other users are not marked by default. [[email protected]/] #ls-l test.txt -rw-r--r--1 root root 91 7 20:21 test.txt If we want to change the owner of a file and the group to which it belongs, you can use the command chown, the parameter R must be uppercase, or you will be prompted for a command error CHOWN-R test:test test.txt Each Linux file has four access rights: Readable (R), writable (W), executable (x) and no permissions (-), no permissions (-) are not discussed. With the ls-l, Ls-ld command, you can see the permissions for a file or directory, whichever is the first field that displays the data. The first field consists of 10 characters, as follows: [[email protected]/] #ls-L test.txt -rw-r--r--1 root root * 7 20:2 1 test.txt The first bit represents the file type,-represents the file, D represents the directory, and every three bits is followed by a group. First group: 2-4-bit represents the permissions of the file owner, that is, user permissions, the name U here indicates that the root user has (rw-) permissions, readable (r) and writable (w) permissions, no executable (x) permissions second group : 5-7 bits represents the permissions of the group member to which the file owner belongs, GROUP permission, referred to as g here, indicates that the root group member has (r--) permissions, only the readable permission. Third group: 8-10 bits represents a user right other than the group to which the owner belongs, and the other permission, the abbreviation O, indicates that the other person has (r--) permissions, and only the readable permissions. Modify permissions for a file or folder [[email protected]/]chmod u+r test.txt//Indicates the right to add read for root user [[ Email protected]/]chmod g-w test.txt//Indicates removal of write permissions for root group [[email protected]/]chmod o+x Test.txt//means other people add executable permissions If we want to add all RWX permissions for all users [[email protected]/]chmod u=rwx,g=rwx,o= RWX test.txt for easier and faster use and familiarity with permissions, rwx permissions can be represented by numbers, respectively, as R (4), W (2), X (1) [root[email Protected]/]chmod 456 test.txt//= Root user has r (4) permission to test, root team Test file has R (4) +x (1) permission, others have RW permissions [[ Email protected]/]chmod 000 test.txt//means remove all permissions
User rights file or directory permissions