After useradd a user, modify the user line in the/etc/passwd file and change the UID to 0 and the GID to 0 (the *** represents a user name) in this way, *** has the root permission.
For example:
Root2: X: 0: 0:/home/root2:/bin/bash
[User name]: [Password]: [uid]: [GID]: [identity description]: [main directory]: [logon shell]
Where:
The alias [user name] is the unique domain with "uniqueness" requirements for each record row in the passwd file. That is to say, the content of the first region of each row cannot be the same, and it doesn't matter if it is other regions.
The encrypt [Password] area previously stores a 13-character DES encrypted by an irreversible hash algorithm, excluding single quotes and colons. Among the 13 characters, the first two are keys, which are randomly generated during encryption. Because this string does not contain single quotation marks, a single quotation mark is added before the password without changing the password and preventing user logon. It is worth noting that the shadow password is only one X character in the password area.
The region [uid] is used by the system to indicate the ownership of the file and identify various permissions. However, the content in this region is not required to be unique. One common example related to security issues is that there are multiple user accounts with UID and GID 0. Note that there is a user imnotroot with UID and GID 0 in the last row of the file. Although it claims that it is not root, it has the same permissions as root, because the system does not divide the user's power based on the [user name], but the UID and GID. Therefore, this situation has undoubtedly laid a security bomb for the system. However, when imnorroot locks the screen, it cannot be unlocked if its password is different from that of root, because the system only finds the first user with a uid of 0 (naturally root), it does not look down-it is also unique when uid.
Consumer [GID] The default group ID. This ID can be found in the file/etc/group.
Principal [identity description]: indicates the user's identity description. By default, no description is provided and can be manually added.
Principal [main directory]: the user's main directory, which can be modified using the commands described earlier.
Login [logon shell]: The shell provided by the system when a user logs on, please refer to the previous content.
<Note>: if the value of [uid] and [GID] is less than 500, they are generally retained by the system and are not identified by common users and groups, therefore, the newly added users and groups are generally UID and GID greater than 500.
Bytes ---------------------------------------------------------------------------------------------------------------------------
Passwd root (modify the root user password)
Bytes ---------------------------------------------------------------------------------------------------------------------------
Userdel-r root2 (the commonly used option is-R. It is used to delete the user's home directory together .)