How to Add and Delete Users on CentOS 8

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.

Recommended CentOS Tutorials

AuthorAdmin

My name is Devendra Dode. I am a full-stack developer, entrepreneur, and owner of Tutsmake.com. I like writing tutorials and tips that can help other developers. I share tutorials of PHP, Python, Javascript, JQuery, Laravel, Livewire, Codeigniter, Node JS, Express JS, Vue JS, Angular JS, React Js, MySQL, MongoDB, REST APIs, Windows, Xampp, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL and Bootstrap from a starting stage. As well as demo example.

Leave a Reply

Your email address will not be published. Required fields are marked *