How to Add and Delete Users on CentOS 7

similarly Add and Delete Users on CentOS 7,CentOS, as well as all other Linux distributions is a multi-consumer operating device. Each user will have different permission level and particular settings for diverse command line and GUI software.

Knowing the way to add and eliminate customers is one of the most important abilties every Linux user have to recognize.

In this educational, we can give an explanation for the way to add and remove users on CentOS 7 structures.

Add and Delete Users on CentOS 7,Prerequisites

You want to be logged in as root or person with sudo privileges to create and put off users.

Add and Delete Users on CentOS 7,How To Add User in CentOS

In CentOS, you could create a brand new user account using the useradd command-line software.

To create a new user account named username you will run:

sudo adduser username

The command above shows no output. It will create the brand new user’s home listing (/home/username), and copy documents from / etc/skel directory to the consumer’s domestic directory. Within the home listing, the user can write, edit, and delete files and directories. furthermore , you’ll want to set a password for the new person in order that the person can log in. To do so, use the passwd command:

sudo passwd username

You could be precipitated to go into and verify the password. Make certain you operate a robust password.


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

By default on CentOS, members of the group wheel are granted with sudo get right of entry to.

If you need the newly created person to have administrative rights, upload the user to the wheel organization:

sudo usermod -aG wheel username
If you’re logged in as root, you don’t have to prepend each command with sudo.

Add and Delete Users on CentOS 7,How To Delete a User in CentOS

If the user account is now not wished, you can delete it the use of the deluser command line tool.

To delete the consumer, with out deleting the user files, run:

sudo userdel username

If you need to delete and the user’s domestic directory and mail spool use the -r flag:

sudo userdel -r username

On fulfillment the userdel command doesn’t produce any output.

likewise If the user become granted sudo privileges it wheel organization will likely be removed the ,

In addition to from any other corporations the user become a member of.