Home>Article>Operation and Maintenance> How to create a new user and set a password in linux
In Linux, you can use the "useradd username" command to create a new user; then use the "passwd username" command to set a password for the created user. You need to enter the password twice to ensure that the password is correct. . The newly created user will create a username directory under "/home".
The operating environment of this tutorial: Red Hat Enterprise Linux 6.1 system, Dell G3 computer.
linuxCreate a new user and set a password
Create user testuser
useradd testuser
Set a password for the created user testuser
passwd testuser
Note: The newly created user will create a user directory testuser under /home
usermod --help
Modify the relevant parameters of this command for the user
userdel testuser
Delete user testuser
##rm -rf testuserDelete the directory where user testuser is located
locate useraddRelated recommendations: "
Linux Video Tutorial"
After creating a new user, the relevant information of the new user will be added to the passwd file in the etc directory Note: In order to take a screenshot, I used thetail -3 passwdcommand to display only the last three lines of information in the file (which is also the information I am concerned about)
su 用户名Description: su is the abbreviation of switch user, which means user switching from the new user state Enter "exit" below to return to the previous user state
groupadd testgroupAdding a group
groupdel testgroupDeleting a group
ctrl cto terminate the shutdown command.
Programming Teaching! !
The above is the detailed content of How to create a new user and set a password in linux. For more information, please follow other related articles on the PHP Chinese website!