banner



How To Create User On Centos

User management is much needed and must-know technique for a Linux server administrator. A Linux administrator often needs to create and grant different privileges and permissions to different users. This post will perform a couple of tasks like creating and deleting the user on the CentOS 8 Operating system.

As you know, the creation and deletion of a user is an administrative type of task, and for performing such tasks, you must log in as a root user or execute all the commands with the sudo privileges. Let's start and see how to add or create a user in the CentOS 8 system.

Creating a user in CentOS 8

The user can be added or created in the CentOS 8 system using the "adduser" command in the terminal. For example, if we want to create a user with the name "John", the command would be like this:


After successfully creating the user, it's time to assign the password to the newly created user. You can simply assign the password using the "passwd" command:

After running the above command, it will prompt for the password, so provide the password twice, and the password will be set for the newly created user.

Granting Sudo privileges to the User

Suppose you want to give administrative rights to this newly created user. In that case, you have to add the user in the wheel group (the group which grants sudo privileges to all of its users automatically). To add the user to the wheel group, type the command given below:

$ sudo usermod -aG wheel john

The administrative rights are granted successfully to the newly created user as well. Now let's see how to delete a user in the CentOS 8 Operating system.

Deletion of a user in CentOS 8

Now, if you want to delete any user from the CentOS 8 Operating system due to any reason, either that user is unnecessary or not needed anymore. For example, if we want to delete the user "john", we can delete such a user using the "userdel" command:

The "-r" flag in the above-given command is for deleting the user's home directory. If you do not want to delete the user's home directory, you can run the above command without the "-r" flag.

This is it; the user is deleted successfully as well from the CentOS 8 Operating system.

Conclusion

This post explains user creation, granting privileges to the user, and deleting a user from the CentOS 8 Operating system. Users with different privileges have a lot to do while managing the Linux servers, and after reading this post, you can manage the users well on CentOS 8 Operating system.

About the author

A Javascript Developer & Linux enthusiast with 4 years of industrial experience and proven know-how to combine creative and usability viewpoints resulting in world-class web applications. I have experience working with Vue, React & Node.js & currently working on article writing and video creation.

How To Create User On Centos

Source: https://linuxhint.com/how-to-create-and-delete-users-on-centos-8/

Posted by: ozunaweland.blogspot.com

0 Response to "How To Create User On Centos"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel