YouTube Icon

Code Playground.

How to Add and Delete Users on CentOS 7


How to Add and Delete Users on CentOS 7

CentOS, just as all other Linux dispersions, is a multi-client working framework. Every client can have distinctive authorization levels and explicit settings for different order line and GUI applications. 

Realizing how to add and eliminate clients is one of the fundamental abilities every Linux client should know. 

In this instructional exercise, we will disclose how to add and eliminate clients on CentOS 7 frameworks. 


You should be signed in as root or client with sudo advantages to make and eliminate clients. 

How To Add User in CentOS

In CentOS, you can make another client account utilizing the useradd order line utility. 

To make another client account named "username" you would run: 

sudo adduser username

The order above showcases no yield. It will make the new client's home catalog (/home/username) and duplicate records from/and so forth/skel index to the client's home registry. Inside the home catalog, the client can compose, alter, and erase documents and registries. 

Next, you'll have to set a secret key for the new client with the goal that the client can sign in. To do as such, utilize the passwd order: 

sudo passwd username

You will be provoked to enter and affirm the secret word. Ensure you utilize a solid secret key. 

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

Of course on CentOS, individuals from the gathering wheel are allowed with sudo access. 

On the off chance that you need the recently made client to have regulatory rights, add the client to the wheel gathering : 

sudo usermod -aG wheel username

In case you're signed in as root, you don't need to prepend each order with sudo. 

How To Delete a User in CentOS

In the event that the client account is not, at this point required, you can erase it utilizing the deluser order line instrument. 

To erase the client, without erasing the client documents, run: 

sudo userdel username

In the event that you need to erase and the client's home registry and mail spool utilize the - r banner: 

sudo userdel -r username

On progress, the userdel order doesn't create any yield. 

On the off chance that the client was allowed sudo advantages, it will be eliminated from the wheel gathering, just as from some other gatherings the client was an individual from. 


In this instructional exercise, you figured out how to add and eliminate clients in CentOS. Similar orders apply for some other Linux conveyance. 

Don't hesitate to leave a remark in the event that you have any inquiries.