In one of my previous post , I wrote about how to add a user with
sudo privilege in Ubuntu linux. In this post, let me write a similar one but for CentOS Linux.
First, let's add a user, which can be done using
For example, if we want to add
johndoe user, then you have to run
Next, we can set the password of the created user using
Running that command, you will be asked to enter a new password, with it's confirmation.
Finally, we have to add the created user to the
wheel group. This can be done uing
usermod command as follows.
usermod -aG wheel username
Members of the
wheel group on CentOS have
Now, if you want to switch to the newly created user by running
su - username
Because the created user has
sudo privilege, we can now run any command prefixed by
sudo yum install vim.