Articles

How to Add and Delete Users on CentOS 8

Add and delete users on centOS 8; Through this tutorial, we will learn how to add and delete users on CentOS 8.

How to Add and Delete Users on CentOS 8

Just follow the following method’s to add and delete users on CentOS 8:

  • How To Add User in CentOS 8
  • How To Delete a User in CentOS 8

How To Add User in CentOS 8

The useradd command-line utility in CentOS can be used to establish a new user account.

We would run the following commands to create a new user account named “username”:

sudo adduser username

There is no output from the command above. It will construct the new user’s home directory (/home/username) and copy files from the /etc/skel directory to it. The user can write, edit, and delete files and folders in their home directory.

After that, we’ll need to provide the new user a password so that they may log in. Use the passwd command to do so:

sudo passwd username

We’ll be asked to type in and confirm password. Make sure password is strong.

Output

Changing password for user username.
New password: 
Retype new password: 
passwd: all authentication tokens updated successfully.

Sudo access is allowed to members of the group wheel by default on CentOS.

Add the newly created user to the wheel group if we want them to have administrative rights:

sudo usermod -aG wheel username

If we are logged in as root, we don’t have to prepend each command with sudo.

How To Delete a User in CentOS 8

We can delete the user account using the deluser command-line utility if it is no longer required.

Run the following command to deactivate the user without removing the user’s files:

sudo userdel username

The -r flag is used to destroy the user’s home directory and mail spool:

sudo userdel -r username

The userdel command produces no output when it succeeds.

If the user has sudo capabilities, he or she will be removed from the wheel group, as well as any other groups to which the user belongs.

Conclusion

Add and delete users on centOS 8; Through this tutorial, we have learned how to add and delete users on CentOS 8.

Images mentioned above related to CentOS are either copyright property of respective image owners.

Rabins Sharma Lamichhane

Rabins Sharma Lamichhane is the owner of RabinsXP who is constantly working for increasing the Internet of Things (IoT) in Nepal. He also builds android apps and crafts beautiful websites. He is also working with various social services. The main aim of Lamichhane is to digitally empower the citizens of Nepal and make the world spiritually sound better both in terms of technology and personal development. Rabins is also the first initiator of Digital Nepal.

Related Articles

Leave a Reply

Your email address will not be published.

Back to top button