How to create a new user and password in Linux: 1. Log in to the terminal command window; 2. Create a new user and password by executing the "useradd -u 6666 -d /root/admin admin" and "passwd admin" commands That’s it.
#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.
How to create a new user and password in Linux?
Create a new user in Linux, set the ID and password
For example: create a new user admin, specify it in the /root home directory, and specify the user ID as 6666, set password: admin@123
Add user
add:用于创建新的系统用户
Syntax: useradd[option] Username
-d specifies the user’s home directory (The default username directory is /home/username, and the root username home directory is /root)
-g specifies the group to which the user belongs
-M does not automatically create a user login directory (default The user login directory is the user's home directory)
-u specifies the user id
passwd is used to set/modify the user password passwd [user name]
whoami is used to display the current login Enter the user name of the system
(For user security, the password input will not be displayed)
Recommended study: "Linux Video Tutorial 》
The above is the detailed content of How to create a new user and password in linux. For more information, please follow other related articles on the PHP Chinese website!