Linux systems generally do not directly use the root user to operate, you need to add new users.
First, view the existing users of the current system
cat/etc/passwd
Next, add the desired user
Useradd [-D home] [-s Shell] [-c comment] [-M [--template]] [-F inactive] [-e expire] [-r] Name
-D: Specifies the home directory at which the user is logged in, replacing the system default/home/< username >-g: Specifies the group to which the user belongs. The value allows the group name to be a GID as well. The user group must already exist, with the default value of 100, which is users. -G: Specifies the additional group to which the user belongs. -m: automatically establish the user's login directory. -M: Do not automatically create a user's login directory. -U: Specifies the user ID number. The value must be unique within the system. 0~499 is reserved for use by the system user account, so the value must be greater than 499.
-P: Specify the user password, but, please note! This parameter should use crypt () encrypted password as the parameter, but not directly clear text, otherwise it will cause login failure
Examples of my application:
useradd-p [email protected]-d/home/users/test test
However, a problem has been encountered: This added user cannot log on because the password is clear text .
So add the user in a different way:
useradd-d/home/users/test Test //Use the-D parameter to specify the user's directory, if you do not specify a default/home/test
Echo Your password | passwd--stdin Test //Set the password in such a way
Finally, delete the system User:
Userdel-r test //parameter-R means to delete all folders related to this user
Linux system Add new user