|
The first step is to add a regular user
Create a user, set a password, modify a user, delete a user: useradd testuser to create a user testuser passwd testuser to set a password for the created user testuser Note: The newly created user creates a user directory under /home, testuser usermod --help modifies the parameters of the user command userdel testuser deletes user testuser rm -rf testuser deletes the directory where the user testuser is located
The above commands are only available to root accounts, if you don't know your ownsystemThe above command can find its path using the following command:
locate useradd The second step is to add permissions Edit the /etc/passwd file, Change the newly added user uid and gid 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 means that specifying uid as 0 (zero) is the same as root, and the prompt after logging in is # instead of $.
-o means that this parameter must be specified because the uid is duplicated (duplicate with the uid of the root account).
-g root initializes the group name of the group, when the user belongs to multiple groups (specified in the -g parameter), the group to which the user is logged in. When this item is defaulted, the system creates a new group with the same name as the user name, and sets it to the group name when initialized. Regardless of which group -G is specified.
-G root specifies the list of groups to which the user name belongs, a user can belong to multiple groups, the group names are separated by commas, and the group names must already exist.
-d /home/user1 specifies the user's home directory
user1 The new user name is user1.
Test: You can use the id user1 command to test the attribute of the username user1, which is displayed as:
uid=0(root),gid=0(root),group=0(root)
Note: The gid indicates the initialization GID number.
|