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

Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of Tutsmake.com. My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including 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. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

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