Most of the operation can be done in two ways i.e. via user interface and via the command line interface (CLI). This turotial of creating new user in CentOS will be donw via the command line terminal. Tutorial covers topics such as creation of user, adding a password, deleting user ans listing the user information.
How do I create new user account on CentOS 7/8 Linux server using command-line?
To create a new user use the following command in your terminal:
After the user has been added you can type users in your terminal and see if the newly created user is displayed or not. Next we need to add a password. In order to do so type the following command:
You will be asked to enter your password and also confirm it. Now after this you can log off and login with the newly created account. Next we need to delete the user from the users list whenever they are no more part of your organization. To do so like adding the user type the following command:
This will delete the user along with the files and directories associated with them in the home directory. Now to finally see the details of users like what groups are they associated with, their group id and user id, etc. you can type the following:
If you will type only id and press enter it will list information of all users that has been created in your system. This way you can create user, add password, delete users and also modify their information from command line