Step 1: Add a common user to create a user, set the password, modify the user, and delete the user: useraddtestuser create user testuserpasswdtestuser to set the password description for the created user testuser: the new user will create a user directory testuseruser under/home...
Step 1: Add a common user
Create users, set passwords, modify users, and delete users:
Useradd testuser create user testuser
Passwd testuser: Set the password for the created user testuser
Note: the newly created user creates a user directory testuser under/home.
Usermod -- help modify the parameters of the user command
Userdel testuser delete user testuser
Rm-rf testuser: delete the directory of user testuser
The above commands can only be used by the root account. if you do not know where the commands on your system are located, you can use the following command to find the path:
Locate useradd
Step 2: Add permissions
Edit the/etc/passwd file,
Change the uid and gid of the newly added user to 0:
Originally:
Testuser: x: 5: 5:/home/testuser:/bin/bash
After modification:
Testuser: x: 0: 0:/home/testuser:/bin/bash
Other methods:
Useradd-u 0-o-g root-G root-d/home/user1 user1
Note:
-U 0 indicates that the uid is specified as 0 (0) and the root is the same. the prompt after logon is # rather than $.
-O indicates that this parameter must be specified because the uid already exists (which is the same as the uid of the root account.
-G root: group name of the initialization group. when a user belongs to multiple groups (specified in the-G parameter), the group in which the user logs on. By default, the system creates a group with the same name as the user name and sets the group name at initialization, regardless of the group specified by-G.
-G root specifies the group list to which the user name belongs. a user can belong to multiple groups. the group names are separated by commas (,). The group names must already exist.
-D/home/user1 specifies the user's home directory
User1.
Test: you can use the id user1 command to test the attributes of user1:
Uid = 0 (root), gid = 0 (root), group = 0 (root)
Note: gid indicates the initialized GID number.
Author 0XCC