Linux create user, set password, modify user, delete user commands

I would like to share with you the commands for creating users, setting passwords, modifying users, and deleting users in the Linux system, hoping to help you.

useradd testuser Create user testuser
passwd testuser Set a password for the created user testuser
Description: The newly created user will create a user directory testuser under /home
usermod --help Modify the relevant parameters of the user command
userdel testuser Delete the user testuser
rm -rf testuser deletes the directory where the user testuser is located

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 commands to find their paths:

locate useradd

After a new user is created, the relevant information of the new user will be added to the passwd file in the etc directory at the same time.
Description: For screenshots, I used the tail -3 passwd command here, and only the last 3 lines of the file (also I information of interest) is displayed

Switch between users in the command line window:
su Username
Description: su is the abbreviation of switch user, which means that the user switches
from the new user state and enters "exit" to return to the previous user state

User group addition and deletion:
groupadd testgroup group addition
groupdel testgroup group deletion
instructions: group addition and deletion information will be reflected in the group file in the etc directory.

If you don't want to shut down after setting the shutdown within 10 minutes, you can use ctrl+c to terminate the shutdown command.

This article permanently updates the link address : http://www.linuxidc.com/Linux/2017-06/144916.htm

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324887875&siteId=291194637