How to remove a user from sudo group in redhat linux?

You will able to execute root privilege commands only if your user account has sudo access. The sudo access can have permissions to execute some specific sort of commands or can have full permissions similar to root account in the system. So be cautious about giving sudo access to user accounts. In this following blog, you will learn how to remove a user account from sudo group in redhat linux.

Prerequisites:

1. Sudo access user account.

Things to mind before removing a user into sudo group :
  1. Ensure you are in the correct host machine using hostname command.
  2. Confirm the user account which is going to remove from sudo(wheel) group.
Here are the steps on how to remove a user account from the sudo(wheel) group in redhat linux:

1. Verify the present access of the user using below command.
id <username>

2. Execute the below command to remove the user from sudo(wheel) group.
sudo gpasswd –d <username> wheel

3. Verify if the user is removed from sudo(wheel) group using below command.

How to delete a group and user account in redhat linux?

Prerequisites:

1. Sudo access user account.

Things to Mind before delete a user or group in redhat linux :
  1. Ensure you are in the correct host machine using hostname command.
  2. Confirm the user account or group name which is going to delete.
Here are the steps to delete a group and user account in redhat linux.
1. Verify the user account using below command
id <username>

2. Validate which users are available in the group which are going to be deleted using below command

sudo grep –i <groupname> /etc/group

3. To delete the user account along with user’s home directory, mailbox from the system, use below command
sudo userdel –rf <username>

or

If you want to delete the user account alone without deleting the home directory and mail box of the user, use below command

sudo userdel <username>
4. Now proceed to delete the group using below command.
sudo groupdel <groupname>

Note : You can’t delete the group if it is assigned to some user’s primary group. So the best way is to check which users are present in the group before deleting the group and reassign the groups for the users.

How do you feel about this post? Drop your comments below..